在给定合并提交SHA1的情况下,你如何看待/显示已完成的git合并冲突解决? [英] How do you see / show a git merge conflict resolution that was done, given a merge commit SHA1?

查看:131
本文介绍了在给定合并提交SHA1的情况下,你如何看待/显示已完成的git合并冲突解决?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当你解决一个冲突,然后进行更改,然后做一个git diff,它会显示两列+和 - ,一列用于我们,另一列用于他们。鉴于repo的git历史中的合并提交,我如何看到由其他人完成的解决方案?在其他情况下,我曾经见过它(在gitk中,我认为),但我似乎无法确定它是否具有此SHA1。

解决方案

如果您知道ref,那么 git show< MERGE_COMMIT> 会显示合并提交完成的解决方案(如果有的话)。

对于日志,使用 git log -p -c git log -p - -cc 。从git log的手册页:

  -c 
使用此选项,合并提交的差异输出显示差异从父母的每个
同时并入合并结果,而不是显示父母和结果之间的一对一
diff。此外,它只列出了所有父母修改的
文件。

--cc
此标志表示-c选项,并进一步压缩补丁输出
省略父母内容只有两个
变体的无趣hunk,合并结果在未经修改的情况下挑选其中一个。


When you resolve a conflict, then stage the changes, then do a git diff, it shows you two columns of +'s and -'s, one for "ours" and one for "theirs". Given a merge commit in a repo's git history, how do I see that resolution, which was done by someone else? In other instances, I've seen it before (in gitk, I think), but I can't seem to determine it for this SHA1 that I have.

解决方案

If you know the ref, then git show <MERGE_COMMIT> will show you the resolution done (if any) for the merge commit.

For log, use git log -p -c or git log -p --cc. From the manpage of git log:

   -c
       With this option, diff output for a merge commit shows the differences from each 
       of the parents to the merge result simultaneously instead of showing pairwise 
       diff between a parent and the result one at a time. Furthermore, it lists only 
       files which were modified from all parents.

   --cc
       This flag implies the -c option and further compresses the patch output by 
       omitting uninteresting hunks whose contents in the parents have only two 
       variants and the merge result picks one of them without modification.

这篇关于在给定合并提交SHA1的情况下,你如何看待/显示已完成的git合并冲突解决?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆