Gerrit with tracked feature branches?

假装没事ソ 提交于 2019-12-11 13:30:46

问题


We (git/gerrit newbs) are trying to use gerrit with feature branches. The workflow we are trying to implement is as follows:

  1. User creates a feature branch, pushes it to the remote repo directly (no review) with git push -u origin users-branch.
  2. As changes pile up in the master branch, user does git pull --rebase origin master (--rebase is needed because otherwise git creates a merge commit, and merge commits cannot be pushed through gerrit).
  3. User continues to push his changes to the remote repo with git push --force origin users-branch (--force is needed because of --rebase at the previous stage; I'm looking for a better way to do this).
  4. Other users can contribute to the feature branch by pushing their own changes.
  5. When the feature is ready, the user pushes it for review with git push origin HEAD:refs/for/master.

The last step doesn't work because commits that were pushed to gerrit at any stage cannot be pushed again.

The gerrit manual suggests to amend the commits you want to push again. This seems complicated and error prone.

It all works if user never pushes his changes to remote repo, because gerrit doesn't see the changes until they are pushed for review. But this is exactly what we don't like.

It seems possible to use a different repo for feature branches, such that gerrit never sees duplicate change IDs, but this again seems like a needless complication.

Is there a way to do what we want safely and elegantly?


回答1:


If you're running at least Gerrit 2.11 you can benefit from the fix for issue 1195 and enable the create-new-change-for-all-not-in-target option to take into account target branch when determining new changes to open.




回答2:


You are trying to work on Gerrit with a pull-request workflow (Like Github, Bitbucket, ...).

We just created a Gerrit client tool to do that:

https://github.com/Cosium/vet

With vet, you can have feature branches and you can add any number of commits without amending or rebasing the feature branch.



来源:https://stackoverflow.com/questions/37390823/gerrit-with-tracked-feature-branches

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!