在git中显示两个提交的非合并差异

在git中显示两个提交的非合并差异

本文介绍了在git中显示两个提交的非合并差异的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个提交,其中一个是另一个的祖先。 (它们恰好是分支的起点和终点,我不认为这很重要,但如果是这样的话,我会包括它的)。



我想以查看两个提交之间的差异,但是不包括在两次提交之间进行的合并提交(即,提交了多个父代的所有提交)期间所做的更改。 (基本上,我想要对分支进行任何真正的提交,不包括合并)。

这可能吗?如果是这样,你如何做到这一点?



如果有必要,假设在合并提交期间没有解决冲突......但是可以处理的解决方案的奖励点他们优雅。

解决方案

您的问题稍微含糊,但我想您想要。

  git log --no-merges -p branch-start..branch-end 


I have two commits, once of which is the ancestor of another. (They happen to be the start and end points of a branch. I don't think that matters, but I'll include it if it does).

I want to see the diff between the two commits, but excluding changes made during merge commits (that is, all commits with more than one parent) that were made between the two commits. (Basically, I want any "real" commit that was made to the branch, excluding the merges.)

Is this possible? If so, how do you accomplish this?

If necessary, assume that there are no conflicts resolved during the merge commits... but bonus points for a solution that can handle them elegantly.

解决方案

Your question is slightly ambiguous but I think you want this.

git log --no-merges -p branch-start..branch-end

这篇关于在git中显示两个提交的非合并差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 19:55