From: "Eckhard Maaß" <eckhard.s.maass@googlemail.com>
To: Robert Dailey <rcdailey.lists@gmail.com>
Cc: Git <git@vger.kernel.org>
Subject: Re: Merge commit diff results are confusing and inconsistent
Date: Fri, 3 May 2019 21:12:31 +0200 [thread overview]
Message-ID: <20190503191231.GA5426@esm> (raw)
In-Reply-To: <CAHd499BEHd79zL76um2oB4YMdScM2icrMXstg1g=xwdBqk43EQ@mail.gmail.com>
On Fri, May 03, 2019 at 10:55:54AM -0500, Robert Dailey wrote:
> 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).
Hold on. Basically, there is no such thing as "committed directly" for a
merge. You only have differences of the commit to its parents. What you
aim for are changes that you cannot find in either preimage - and this
can be observed best with the --cc option. Maybe also interesting would
be -c for showing a comined diff and -m for showing diffs to parents
after one another.
> 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:
There shouldn't be "just the diff of <commit>" - you always have to tell
where to diff it too, intrinsically Git does not save patches, but the
whole content, after all.
>
> $ 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.
Somebody else might know better why the diff actually produced the
results you were looking for. I admit it is puzzling to me - I would
have expected to error it out on the output of git rev-parse as there
are three items.
Greetings,
Eckhard
next prev parent reply other threads:[~2019-05-03 19:12 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-03 15:55 Merge commit diff results are confusing and inconsistent Robert Dailey
2019-05-03 19:12 ` Eckhard Maaß [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190503191231.GA5426@esm \
--to=eckhard.s.maass@googlemail.com \
--cc=git@vger.kernel.org \
--cc=rcdailey.lists@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.