Show conflict diff part of a merge

被刻印的时光 ゝ 提交于 2019-11-29 14:14:05

问题


I need to present to the team what changes I've made during conflict resolution of a merge.

I know this is kind of hard, but I certainly believe it is possible somehow. I've tried already git show -m and git show -c.


回答1:


Look at the hash (or tag) of the merge commit (the commit that has multiple parents) and do:

git diff hash hash^1 hash^2

It will output a 3 way-diff of the changes.

hash^ (or hash^1) references the first parent commit of hash
hash^2 references the second parent commit of hash




回答2:


If you use the standard gitk tool, and click on a merge commit, the lower left pane shows the conflict resolutions.




回答3:


Just use

git diff ORIG_HEAD MERGE_HEAD(or FETCH_HEAD)

MERGE_HEAD holds for your local merged files, ORIG_HEAD is the commit possible conflicting that you want to merge.

FETCH_HEAD is the hash for the repo you fetch changes before merging.

As said above, PULL only does fetch (in the remote repo, possible origin) and a Merge

In case of doubt see your .git folder to see the files where hashes are being stored.



来源:https://stackoverflow.com/questions/16573555/show-conflict-diff-part-of-a-merge

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