git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Invisible file remove during merge
@ 2016-10-11  1:04 Octavio Alvarez
  2016-10-11  2:42 ` Jeff King
  0 siblings, 1 reply; 2+ messages in thread
From: Octavio Alvarez @ 2016-10-11  1:04 UTC (permalink / raw)
  To: git

Hi.

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 --all --stat --follow -- mysterious-file.txt" only shows the
commit where the file was added.

I also tried --full-history

I prepared a sample repository that exhibits a behavior I was not expecting:

https://github.com/alvarezp/invisible-remove-git-demo

Am I missing some option?

Thanks.


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

* Re: Invisible file remove during merge
  2016-10-11  1:04 Invisible file remove during merge Octavio Alvarez
@ 2016-10-11  2:42 ` Jeff King
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff King @ 2016-10-11  2:42 UTC (permalink / raw)
  To: Octavio Alvarez; +Cc: git

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

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

end of thread, other threads:[~2016-10-11  2:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-11  1:04 Invisible file remove during merge Octavio Alvarez
2016-10-11  2:42 ` Jeff King

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).