gerrit流程

来源:互联网 发布:央视揭网络消费陷阱 编辑:程序博客网 时间:2024/06/02 06:36

gerrit流程

准备工作

配置ssh-keys,作用:在不输入密码的情况下,和Git服务器进行通信。
1.
cd ~ 
ssh-keygen -t rsa  -C  "yu.xia@zhongtoutiandi.com"

2. 运行完成后, 会在/c/Documents and Settings/username/.ssh目录下生成2个文件:
id_rsa
id_rsa.pub

3 写字板打开id_rsa.pub,将内容复制到gerrit->Settings->SSH Public Keys->add key

4.ssh -p 29418 yu.xia@192.168.1.174  //检测ssh是否成功


登录gerrit:http://192.168.1.174:8084/gerrit/
Project->list->General->Clone with commit-msg hook->ssh
git clone ssh://yu.xia@192.168.1.174:29418/android_coinvsinvest && scp -p -P 29418 yu.xia@192.168.1.174:hooks/commit-msg android_coinvsinvest/.git/hooks/
3.   修改代码: 
git commit  的title的一些规范
    feat:新功能(feature)
    fix:修补bug
    docs:文档(documentation)
    style: 格式(不影响代码运行的变动)
    refactor:重构(即不是新增功能,也不是修改bug的代码变动)
    test:增加测试
    chore:构建过程或辅助工具的变动

参考:http://www.oschina.NET/news/69705/git-commit-message-and-changelog-guide

不满意上次提交,重新提交


修改
git add .
git commit --amend
git push origin HEAD:refs/for/<branch>
在网页中会看到patch set(2/2)




例子: 一个人接到一个开发功能模块,需要一个星期才能完成。发信新建function分支。
(1) git checkout  feature
(2) 写代码,git add . git commit . git push。 提交gerrit审核,submit。
第二天:
(3) git pull  origin master   //始终保持是最新代码。防止最后merge有很多冲突
如果有冲突,解决冲突,提交gerrit,submit.继续添加功能。提交gerrit,submit.
第七天:功能完成,测试。
(4) git checkout master
     git pull  --rebase
     git merge --no-ff feature. //把之前的提交都submit.
     git commit --amend
     git push origin HEAD:refs/for/master  //提交gerrit, submit