threads / discuss / 27846

What changed in merge commit?

Subject: What changed in merge commit?

## tl;dr

5 messages between Jul 18, 2011 and Jul 18, 2011.

replies: 4people: 4as markdown or json

Patrick Doyle· Jul 18, 2011, 16:44 UTC · lore

Since today seems to be my day to hang out on this list, I thought I'd ask another burning question...

How can I see what changed in a merge commit?
$ git log
just says "merge remote branch 'origin/master' into wpd" and
$ git log --name-status
says the same thing -- it doesn't list any files as having changed.

Perhaps nothing changed between the last time I merged with origin/master and the current time. I know that at least one change was committed. I suppose it's possible that two (or more) changes were committed, undoing that one change. (But I don't think that's likely).

I could go back and look at the log for origin/master... and I'm sure there's some way to say "just give me the log of changes since the last time I merged", or more to the point now, "just give me the log of changes since the time before the last time I merged". It probably has something to do with a couple of ref names, a caret, and some dots, but I get lost in all of that syntax.

Thanks for the tips.
--wpd
Erik Faye-Lund· Jul 18, 2011, 16:52 UTC · re: Patrick Doyle · lore

Re: What changed in merge commit?

On Mon, Jul 18, 2011 at 6:44 PM, Patrick Doyle <wpdster@gmail.com> wrote:
Show 12 quoted lines
> Since today seems to be my day to hang out on this list, I thought I'd
> ask another burning question...
>
> How can I see what changed in a merge commit?
>
> $ git log
>
> just says "merge remote branch 'origin/master' into wpd" and
>
> $ git log --name-status
>
> says the same thing -- it doesn't list any files as having changed.

That's because nothing did change; it's the merge's parents that are the commits that changed something. If there was a fix-up (either due to a merge-conflict or an explicitly squashed-in change), then that would show up for the merge-commit.

You probably want to do something like "git diff SHA1-OF-MERGE^ SHA1-OF-MERGE" to see what the merge changed compared to it's previous commit.

Christof Krüger· Jul 18, 2011, 17:10 UTC · re: Erik Faye-Lund · lore

Re: What changed in merge commit?

On Mo, 2011-07-18 at 18:52 +0200, Erik Faye-Lund wrote:
> You probably want to do something like "git diff SHA1-OF-MERGE^
> SHA1-OF-MERGE" to see what the merge changed compared to it's previous
> commit.

You could also use "git log --name-status -m" which will show multiple entries for each parent of the merge commit. See "man git-diff-tree" and look for the description of the options -m, -c and --cc

Bye,
  Chris
Patrick Doyle· Jul 18, 2011, 17:25 UTC · re: Christof Krüger · lore

Re: What changed in merge commit?

2011/7/18 Christof Krüger <git@christof-krueger.de>:
> You could also use "git log --name-status -m" which will show multiple
> entries for each parent of the merge commit.
> See "man git-diff-tree" and look for the description of the options -m,
> -c and --cc
Thanks...
$ git log --name-status -m --first-parent

is what I was looking for. I thought I recalled there being something like that, but could not recall nor find on the git-log man page the "-m" option. Of course I can see it now :-)

Thanks for pointing me in the right direction.
--wpd
Andreas Schwab· Jul 18, 2011, 20:39 UTC · re: Patrick Doyle · lore

Re: What changed in merge commit?

Patrick Doyle <wpdster@gmail.com> writes:
> How can I see what changed in a merge commit?

`git show -m' will show a diff for each parent. See "Diff Formatting" in git-log(1).

Andreas.
-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

← back to recent threads