我们一直在考虑将Git仅用于Gerrit审核环境,因为我们希望启用代码审核并运行自动单元测试等。
我们也想去Git流程工作流程(因为人们已经习惯了)(https://www.atlassian.com/git/tutorials/comparing-workflows/feature-branch-workflow)
现在,我想知道我们的第一种方法是否适用于现实生活。
我们已设置以下访问控制:
[access "refs/*"]
owner = group MyProject Admin
owner = group MyProject Project Owner
[access "refs/for/refs/heads/*"]
push = group MyProject Contributor
push = group MyProject Developer
push = group MyProject Integrator
push = group MyProject Project Owner
pushMerge = group MyProject Developer
pushMerge = group MyProject Integrator
pushMerge = group MyProject Project Owner
forgeCommitter = group MyProject Integrator
forgeCommitter = group MyProject Project Owner
[access "refs/tags/*"]
read = group MyProject CI System
read = group MyProject Contributor
read = group MyProject Developer
read = group MyProject Project Owner
pushTag = group MyProject Integrator
pushTag = group MyProject Project Owner
[access "refs/heads/feature/*"]
read = group MyProject Contributor
read = group MyProject Developer
read = group MyProject Integrator
read = group MyProject Project Owner
create = group MyProject Contributor
create = group MyProject Developer
create = group MyProject Integrator
create = group MyProject Project Owner
forgeAuthor = group MyProject Contributor
forgeAuthor = group MyProject Developer
forgeAuthor = group MyProject Integrator
forgeAuthor = group MyProject Project Owner
push = group MyProject Contributor
push = group MyProject Developer
push = group MyProject Integrator
push = group MyProject Project Owner
pushMerge = group MyProject Contributor
pushMerge = group MyProject Developer
pushMerge = group MyProject Integrator
pushMerge = group MyProject Project Owner
rebase = group MyProject Contributor
[access "refs/heads/*"]
read = group MyProject CI System
read = group MyProject Contributor
read = group MyProject Developer
read = group MyProject Integrator
read = group MyProject Project Owner
create = group MyProject Integrator
forgeAuthor = group MyProject Developer
forgeAuthor = group MyProject Integrator
forgeAuthor = group MyProject Project Owner
push = group MyProject Integrator
push = +force group MyProject Project Owner
pushMerge = group MyProject Integrator
pushMerge = group MyProject Project Owner
label-Code-Review = -2..+2 group MyProject Developer
label-Code-Review = -2..+2 group MyProject Integrator
label-Code-Review = -2..+2 group MyProject Project Owner
label-Code-Review = -1..+1 group MyProject Contributor
label-Code-Review = -1..+0 group MyProject CI System
label-Verified = -1..+1 group MyProject Developer
label-Verified = -1..+1 group MyProject Integrator
label-Verified = -1..+1 group MyProject Project Owner
label-Verified = +0..+1 group MyProject CI System
submit = group MyProject Developer
submit = group MyProject Integrator
submit = group MyProject Project Owner
因此,所有功能都将在refs / heads / feature / *下。计划是从开发分支开始,从中创建一个功能并处理该功能。
git checkout -b feature/new-feature-xy develop
在功能分支的工作期间,将执行几个新的提交。要启用与其他团队成员的协作(多个成员可以使用相同的功能),用户将推送和拉取功能分支。
<do changes> # Do some work
$ git add <files> # Add files for revision (git add --all for add all files)
$ git commit –m ‘<Commit message>’ # or ammend if you like
$ git pull # Merge new commits from other users
$ git pull origin/develop # Merge from develop
$ git push # Push the feature for other team members
当声明分支功能/ new-feature-xy上的功能完成时,我们压缩所有提交并将其合并到develop分支。添加它以供审核。
$ git checkout develop # Change branch to develop
$ git pull # Update develop
$ git merge --squash feature/new-feature-xy #Squash all commits in feature branch, merge it
$ git push origin HEAD:refs/for/develop # Push for review
这是一个可接受的Gerrit工作流程,或者你认为我们将来会以这种方式遇到问题吗?