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

查看:98
本文介绍了如何“混帐显示”即使每个更改的文件都与父母之一一致,合并提交也会结合差异输出吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在完成一个简单合并(一个没有冲突)之后, git show 通常只显示像

  commit 0e1329e551a5700614a2a34d8101e92fd9f2cad6(HEAD,master)
合并:fc17405 ee2de56
作者:Tilman Vogel< email @ email>
日期:2月22日星期二00:27:17 2011 +0100

将分支测试合并到主

这是因为,对于合并, git show 使用组合diff格式,省略与父版本中的任一个版本相同的文件。

有没有办法强制git仍然显示组合比较模式中的所有差异?

执行 git show -m 会显示差异(分别使用新版本与所有父版本之间的成对差异)但我宁愿在组合模式下在相应列中用+/-标记差异。

解决方案

有些下面的答案实际上回答了问题。有一种方法可以做到这一点。



apenwarr的原始回复:


否,没有办法做到这一点。但是有时候它肯定会很好
,而且它可能相对容易在
中实现git源代码(毕竟,你只需要告诉它不是 trim
表示它认为是无关输出),所以这样做的修补程序可能会被git维护者接受。

请注意什么你希望,但;将分支与三个月前分行的单行
变化合并在一起,仍然会有一个巨额 diff
与主线相比,所以这样的完全差异几乎为
完全无益。这就是为什么git不显示它。



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

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

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

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.

解决方案

Some answers below actually answer the question. There is a way to do this.

apenwarr's original response:

No, there is no way to do this. 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.

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.

这篇关于如何“混帐显示”即使每个更改的文件都与父母之一一致,合并提交也会结合差异输出吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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