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

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

问题描述

当您解决冲突,然后暂存更改,然后执行 git diff 时,它会向您显示两列 + 和 -,一列代表我们的",另一列代表他们的".鉴于回购的 git 历史记录中的合并提交,我如何查看由其他人完成的解决方案?在其他情况下,我以前见过它(我认为在 gitk 中),但我似乎无法为我拥有的这个 SHA1 确定它.

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.

推荐答案

如果您知道 ref,那么 git show 将显示为合并完成的解决方案(如果有)提交.

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

对于日志,使用 git log -p -cgit log -p --cc.来自 git log 的联机帮助页:

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天全站免登陆