Is it possible to add patch sets to a Gerrit review without ammending/squashing commits

霸气de小男生 提交于 2020-01-02 03:31:08

问题


A simple example. I commit a change to Gerrit, which breaks the CI build or a reviewer is not satisfied. I then fix my change with another commit. In many cases this is small patch set for which I do not want a new gerrit review but rather as a new patch set in the original review.

I know this can be achived using ammend or rebasing and squashin.

Is this the only options? We are a little bit concerned about having to rewrite history using rebasing and squashing.

Thanks,

Giao.


回答1:


git commit --amend works pretty well; that how we do it most of the time.




回答2:


This has been discussed on the gerrit mailing list: http://groups.google.com/group/repo-discuss/browse_thread/thread/fc4246f02b77aa9a




回答3:


Gerrit "patches" are meant as a replacement for the original change being reviewed, not a child commit. The 2nd and subsequent patches are not rewriting history, they are replacements for the present. As such an "amendment" is suitable because history has not been written yet.

Re-basing means you change the lineage of your original work. Amending also makes a new commit and thus the commit time stamp for legal purposes, but does not change the lineage.

If you were to have your CI build on an "integration" branch instead and accept periods of instability, you could submit a "fix" for review first and have a "Try build" of the change commit for sanity, and only do CI builds when those reviews are merged. This would mean never needing to change history, but you may get much more history as you iterate through various attempts at cleanliness in the design.

Gerrit/Git allows re-writes so that open source, which cares less about provenance, can keep a tidier history. Enterprises which care can use a more accurate history approach.




回答4:


It might be worth noting that as of version 2.11 (released April 2015), Gerrit offers the possibility to edit changes using the web UI. This feature is described in-depth in the official documentation.

When viewing a diff, simply click the edit button:

Edit the file as you see fit, then save the file. You can edit multiple files and then hit Publish edit to create a new patch set.



来源:https://stackoverflow.com/questions/6357187/is-it-possible-to-add-patch-sets-to-a-gerrit-review-without-ammending-squashing

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