Git - 检测是否因冲突而重新定位

时间:2017-08-04 06:28:14

标签: git version-control merge gerrit rebase

我想知道是否有办法检测提交是否通过手动冲突解决方案或使用Git的自动rebase(没有冲突)进行重新定位。

详细说来,比方说,在Gerrit中,挂起的提交需要一个rebase,因为一些提交在审核期间合并。在这种情况下,开发人员需要在重新定位后上传新补丁。审稿人想要知道它是一个自动合并而没有冲突(使用#git pull --rebase)或由于冲突而发生手动合并。如果发生手动冲突,管理员可能希望更有意识地进行审核。否则管理员对Git有信任。

有没有办法使用Git / Gerrit API?

1 个答案:

答案 0 :(得分:1)

You can use git cherry <branch after rebase> <branch before rebase>. It searches for "equivalent" changes and lists those which do not have equivalent with "+". If there was a conflict while rebasing, then patch changes, so change is no longer equivalent.

It creates some amount of false positives, when concurrent changes are close enough to consider commit not equivalent, but distant enough to not trigger a conflict.