Craig Walker Craig Walker - 1 year ago 87
Git Question

Show non-merge differences for two commits in git

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.

Answer Source

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

git log --no-merges -p branch-start..branch-end
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download