git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Adam Majer <adamm@zombino.com>
Cc: git@vger.kernel.org
Subject: Re: git and appending merge commits
Date: Sun, 25 May 2008 21:59:28 -0700	[thread overview]
Message-ID: <7vej7pek3z.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <483A300E.6090104@zombino.com> (Adam Majer's message of "Sun, 25 May 2008 22:35:42 -0500")

Adam Majer <adamm@zombino.com> writes:

> Is current output by design?

Yes, it is _very much_ by design and it not "messed up" at all.  Look at
the output of URL you quoted and notice that you are asking for condensed
combined diff ("diff --cc").

For a merge commit with N parents, you can define "a diff for the
resulting merge commit" in various ways:

 * You could have a set of diffs between each parent to the merge result.
   You can get this with "git diff-tree -p -m $commit".

 * You could say the first parent is special, and define it as the diff
   between its first parent and the merge result.  You can get this by
   asking "git diff $commit^1 $commit".

 * You can say what non-trivial changes the merge itself did.  This is the
   combined merge and what "git show $commit" (and "git log -p") gives.

Depending on what you want, you can ask these various forms of diffs.

When you are reviewing the changes series of commits introduced to the
history (iow, "git log -p"), a single diff between parent and the merge
result is not so interesting, primarily because each individual change
from commits on each side branch is (or should be) much easier to read and
understand, but if a merge needed to do something non-trivial to resolve
conficts, you would want to know about it, and that is the reason why --cc
format is the default.

In a combined diff, unlike the single column to show "+/-/ " at the
beginning for one-parent diff, each parent gets one column.  And in a
condensed combined diff, a hunk whose result is inherited solely from one
parent (iow, a trivial conflict resolution) is removed from the output, so
that only a non-trivial conflict resolution that leaves result that is
different from all parents are shown.

  parent reply	other threads:[~2008-05-26  5:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-26  3:35 git and appending merge commits Adam Majer
2008-05-26  4:51 ` Shawn O. Pearce
2008-05-26  4:59 ` Junio C Hamano [this message]
2008-05-26  6:39   ` Adam Majer

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=7vej7pek3z.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=adamm@zombino.com \
    --cc=git@vger.kernel.org \
    /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 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 NNTP newsgroup(s).