git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: Octavio Alvarez <alvarezp@alvarezp.ods.org>
Cc: git@vger.kernel.org
Subject: Re: Invisible file remove during merge
Date: Mon, 10 Oct 2016 22:42:04 -0400	[thread overview]
Message-ID: <20161011024204.dg756vuej4rvg4tl@sigill.intra.peff.net> (raw)
In-Reply-To: <d7e42701-363b-70a4-8eb0-da4715cd9ba5@alvarezp.ods.org>

On Mon, Oct 10, 2016 at 06:04:26PM -0700, Octavio Alvarez wrote:

> If I do a "git rm file" during conflict resolution, the removed file
> (mysterious-file.txt) does not show up on "git log --stat" nor "git show
> --patch" for the merge commit.

"git log" does not do merge diffs by default; you need to pass one of
"--cc", "-c", or "-m".

"git show" will do "--cc" by default. Any file that is the same in the
merge result and _any_ of the branches is considered uninteresting here,
and that is what happened in your example. One parent had the file, the
other did not, and you deleted it to match the second parent.

See the "Combined Diff" section of "git help log" for more details.

When debugging merge resolutions, I often find it useful to use "-m",
which diffs separately against _each_ parent (though it is often tedious
to pick through the uninteresting bits, which is why "-c" and "--cc"
were invented in the first place).

> "git log --all --stat --follow -- mysterious-file.txt" only shows the
> commit where the file was added.

Try that with "-m", which will show the merge in question (and another,
more boring merge, which hopefully shows why "-m" is not the default).

-Peff

      reply	other threads:[~2016-10-11  2:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-11  1:04 Invisible file remove during merge Octavio Alvarez
2016-10-11  2:42 ` Jeff King [this message]

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161011024204.dg756vuej4rvg4tl@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=alvarezp@alvarezp.ods.org \
    --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.
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).