git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Lars Schneider <larsxschneider@gmail.com>
Cc: Git List <git@vger.kernel.org>, Derrick Stolee <stolee@gmail.com>
Subject: Re: How to debug a "git merge"?
Date: Thu, 15 Mar 2018 10:09:21 -0400	[thread overview]
Message-ID: <20180315140921.GA27748@sigill.intra.peff.net> (raw)
In-Reply-To: <1632E897-B434-4ECC-A236-49C03398DF55@gmail.com>

On Thu, Mar 15, 2018 at 10:51:27AM +0100, Lars Schneider wrote:

> > Maybe a stupid question, but: did you make sure that the merge does
> > indeed pick the wrong version of the file? The other option is that
> > somebody mistakenly did a "checkout --ours" or similar while resolving
> > the conflict.
> 
> No stupid question at all. That's exactly what they did and I did not
> realize it! Thank you!

Oh good. :) I have run across this same situation before myself, which
is why I thought to ask about it.

> Next time I won't stumble over this. I wonder if this is a common enough
> problem to do something about it? For instance what if `git log` (or just
> `git show`) has an option `--verify-merges` or `--reenact-merges` or 
> something? This option would perform a "default recursive merge" and 
> show the diff between the actual merge and the default merge?
> 
> In the most common case there is no diff. If there are merge conflicts
> then we would just show the conflicting files. If there is no merge
> conflict for a file *but* a difference then we would show it. I think
> this would have helped me to realize this kind of problem earlier.
> 
> Would that option make sense to you?

Yes, it's absolutely a good idea, and a frequent wish-list item. The
problem is that it's tricky to implement. The only working patches I
know of were Thomas Rast's "--remerge-diff" from 2014:

  https://public-inbox.org/git/cover.1409860234.git.tr@thomasrast.ch/

The tricky thing is that you have to actually re-run the diff, and we
don't know what options were used for the original diff (e.g., what
strategy). And also, merge-recursive really wants to have a valid
working tree (though I think maybe that has gotten better over the
years).

But even with those warts, I still found it useful in many cases.

-Peff

  reply	other threads:[~2018-03-15 14:09 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-14 16:56 How to debug a "git merge"? Lars Schneider
2018-03-14 17:02 ` Derrick Stolee
2018-03-14 20:53   ` Lars Schneider
2018-03-20  1:32     ` Derrick Stolee
2018-03-14 22:20 ` Jeff King
2018-03-15  9:51   ` Lars Schneider
2018-03-15 14:09     ` Jeff King [this message]
2018-03-15 15:51       ` Elijah Newren

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=20180315140921.GA27748@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=larsxschneider@gmail.com \
    --cc=stolee@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 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).