简体   繁体   English

gitk 可以默认显示合并的差异吗?

[英]Can gitk show the diff of merges by default?

Currently for merges without conflicts gitk shows no diffs.目前对于没有冲突的合并, gitk没有显示差异。 Is it possible to have the diffs resulting from a merge (which are indeed there, eg git diff HEAD~1 after the merge shows these diffs) shown by defautl, eg using a command line switch?是否有可能由 defautl 显示合并产生的差异(确实存在,例如合并后的git diff HEAD~1显示这些差异),例如使用命令行开关? Or why does gitk by default not show them?或者为什么 gitk 默认不显示它们?

By default gitk does the same thing as the --cc option to git diff and compresses the merge to only show diff chunks that don't come directly from one or other parent. 默认情况下, gitkgit diff--cc选项的作用相同,并且压缩合并以仅显示不直接来自一个或其他父级的diff块。 This is usually more helpful as conflicts are the interesting part of merges, the other parts of the diff will already appear in the diffs for the commits that made up the branch which was merged in. 这通常更有用,因为冲突是合并的有趣部分,diff的其他部分已经出现在组成合并的分支的提交的差异中。

The easiest way to view the full diff between a parent of a merge and the merge commit is to select the parent (normal click) and from the context menu on the merge commit (right/alternate click menu) select "Diff selected -> this". 查看合并父和合并提交之间的完整差异的最简单方法是选择父(正常点击),然后从合并提交的上下文菜单中选择(右/备用点击菜单),选择“Diff selected - > this” ”。

是的,您可以使用gitk --no-merges来做到这一点。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM