如何“git show"即使每个更改的文件都与其中一个父文件一致,合并提交与合并的差异输出? [英] How to "git show" a merge commit with combined diff output even when every changed file agrees with one of the parents?

查看:18
本文介绍了如何“git show"即使每个更改的文件都与其中一个父文件一致,合并提交与合并的差异输出?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在做了一个简单"的合并(没有冲突的)之后,git show 通常只显示类似

After doing a "simple" merge (one without conflicts), git show usually only shows something like

commit 0e1329e551a5700614a2a34d8101e92fd9f2cad6 (HEAD, master)
Merge: fc17405 ee2de56
Author: Tilman Vogel <email@email>
Date:   Tue Feb 22 00:27:17 2011 +0100

Merge branch 'testing' into master

这是因为,对于合并,git show 使用组合差异格式,该格式忽略与任一父版本一致的文件.

This is because, for merges, git show uses the combined diff format which omits files that agree with either of the parent versions.

有没有办法强制 git 在组合差异模式下仍然显示所有差异?

Is there a way to force git to still show all differences in combined diff mode?

执行 git show -m 将显示差异(分别使用新版本和所有父版本之间的成对差异),但我更希望在各自的版本中使用 +/- 标记的差异列如组合模式.

Doing git show -m will show the differences (using pairwise diffs between the new and all parent versions respectively) but I would prefer to have that with the differnces marked by +/- in the respective columns like in combined mode.

推荐答案

不,git show 无法做到这一点.但有时它肯定会很好,并且在 git 源代码中实现它可能相对容易(毕竟,你只需要告诉它不要修剪掉它认为无关的输出),所以这样做的补丁可能会被 git 维护者接受.

No, there is no way to do this with git show. But it would certainly be nice sometimes, and it would probably be relatively easy to implement in the git source code (after all, you just have to tell it to not trim out what it thinks is extraneous output), so the patch to do so would probably be accepted by the git maintainers.

尽管如此,请注意您的愿望;将分支与三个月前分叉的单行更改合并,与主线相比仍然存在巨大 差异,因此如此完整的差异几乎完全没有帮助.这就是 git 不显示它的原因.

Be careful what you wish for, though; merging a branch with a one-line change that was forked three months ago will still have a huge diff versus the mainline, and so such a full diff would be almost completely unhelpful. That's why git doesn't show it.

这篇关于如何“git show"即使每个更改的文件都与其中一个父文件一致,合并提交与合并的差异输出?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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