git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Merge commit diff results are confusing and inconsistent
@ 2019-05-03 15:55 Robert Dailey
  2019-05-03 19:12 ` Eckhard Maaß
  0 siblings, 1 reply; 12+ messages in thread
From: Robert Dailey @ 2019-05-03 15:55 UTC (permalink / raw)
  To: Git

I'm hoping this is mostly a learning opportunity for me. I'm assuming
things are working as designed, but I just don't understand something
fundamental.

I have a merge commit. HEAD is currently pointing at this merge
commit. To be exact, HEAD points to master, which points to the merge
commit. My goal is to diff only the changes in the merge commit (stuff
committed directly in the merge commit, such as conflict resolutions).
To start out, I learned about @^@, @^!, and @^-. @^! sounded like what
I wanted. It gives me this output:

$ git rev-parse @^!
21f5a4b9fee4f12e7793919f65361d2c16f7d240
^14bd840c1d591c9dc066ed1aab59b5ec14d502bb
^944af379480826764f2f31b67848e2885b95b4a6

Perfect. This should give me just the diff of 21f5... and exclude
everything else, right? So I did this:

$ git diff @^!

However, I get *all* changes on the branch (second parent) and changes
in the merge commit itself. Basically it acts as if I used @^-, which
seems wrong to me. So to test another angle, I used the revisions
output by rev-parse directly:

$ git diff 21f5a4b9fee4f12e7793919f65361d2c16f7d240
^14bd840c1d591c9dc066ed1aab59b5ec14d502bb
^944af379480826764f2f31b67848e2885b95b4a6

Interestingly, this showed me only the changes in the merge commit
(21f5a4) and nothing else. Between this command and @^!, I feel the
two are exactly the same. So why does @^! not work as I expect, but
explicitly specifying the revisions does? What am I missing here?

When I use @^! in `git log`, I do only see the merge commit and no
other commits. So at least log is treating it correctly.

$ git version
git version 2.20.1.windows.1

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2019-05-11 14:08 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-03 15:55 Merge commit diff results are confusing and inconsistent Robert Dailey
2019-05-03 19:12 ` Eckhard Maaß
2019-05-06 15:38   ` Robert Dailey
2019-05-06 16:52     ` Eckhard Maaß
2019-05-06 23:52     ` Ævar Arnfjörð Bjarmason
2019-05-07 14:10       ` Robert Dailey
2019-05-07 14:41         ` Robert Dailey
2019-05-07 14:58         ` Denton Liu
2019-05-07 15:55           ` Eckhard Maaß
2019-05-07 15:26         ` Ævar Arnfjörð Bjarmason
2019-05-07 16:44         ` Elijah Newren
2019-05-11 14:08         ` Philip Oakley

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).