git 显示合并的冲突差异部分
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16573555/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Show conflict diff part of a merge
提问by brauliobo
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 -mand git show -c.
我知道这有点困难,但我当然相信这是可能的。我已经尝试过git show -m并且git show -c.
采纳答案by KurzedMetal
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.
它将输出更改的 3 向差异。
hash^(or hash^1) references the firstparent commit of hashhash^2references the secondparent commit of hash
hash^(或hash^1) 引用第一个父提交的hashhash^2引用 引用的第二个父提交hash
回答by Klas Mellbourn
If you use the standard gitktool, and click on a merge commit, the lower left pane shows the conflict resolutions.
如果您使用标准gitk工具并单击合并提交,左下方的窗格将显示冲突解决方案。
回答by Syncaa
Just use
只需使用
git diff ORIG_HEAD MERGE_HEAD(or FETCH_HEAD)
MERGE_HEADholds for your local merged files, ORIG_HEADis the commit possible conflicting that you want to merge.
MERGE_HEAD对于您的本地合并文件,ORIG_HEAD您要合并的提交是否可能存在冲突。
FETCH_HEADis the hash for the repo you fetch changes before merging.
FETCH_HEAD是您在合并之前获取更改的存储库的哈希值。
As said above, PULLonly does fetch (in the remote repo, possible origin) and a Merge
如上所述,PULL只获取(在远程仓库中,可能的来源)和一个Merge
In case of doubt see your .gitfolder to see the files where hashes are being stored.
如有疑问,请查看您的.git文件夹以查看存储哈希的文件。

