Gerrit always rebase before submit patchset to avoid a merge commit

匿名 (未验证) 提交于 2019-12-03 02:49:01

问题:

I found that when clicking "Submit Patch Set" in the Gerrit web interface, it'll either simply add a commit to that branch, or create a merge commit if another commit was submitted just before.

Example that creates 2 commit: The actual commit and a merge commit:

  1. User submits patchset A depending on commit O
  2. User submits patchset B depending on commit O
  3. Submit Patch Set A
  4. Submit Patch Set B --> Creates merge commit between O -> A and O -> B

There is a "Rebase Change" button which is great but it means that to submit a patch set everyone should always do:

  1. Click Rebase Change
  2. Click Submit Change Set

The only reason I see a merge commit useful is to keep dates of the commits (but I do understand why it is required without a rebase).

Isn't there an automatic rebase or at least a check to avoid generating an undesired merge commit?

回答1:

Yes. Change the Submit Action for your project(s) to Cherry Pick. This will do roughly the same as rebasing when the submit button is pressed. It will keep the clean history you are looking for with no merge commits when submitting changes.



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