git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: How to tell what paths changed in a merge?

From
Jeff King <peff@peff.net>
Date
Mar 28, 2011, 20:20 UTC
Message-ID
<20110328202039.GA27755@sigill.intra.peff.net>
In-Reply-To
<AANLkTi=DOf0beuts8TO0c5JJtDtjNAcQ_4hcKNkZoXjM@mail.gmail.com>
On Mon, Mar 28, 2011 at 03:48:01PM -0400, Patrick Doyle wrote:
Show 5 quoted lines
> I have a situation where somebody got confused while trying to
> commit/push/pull from the repository and some changes to some files
> got lost.
> 
> How can I tell which files got selected in a merge?

I'm not exactly sure what you mean by "selected". A merge commit is a tree state with two parent commits. So you can look at what's different in the merged state versus either parent, or there are some special ways of looking at it all together.

You might want to try:
  # show a "combined diff"; lines with +/- in the first column came from
  # the first parent of the merge (i.e., where you were when you ran
  # "git merge" or "git pull"). The ones in the second column came from
  # the second parent (the thing you merged).
  git show -c 1e5e614
  # show a condensed combined diff; this is like "-c", except that it
  # eliminates "uninteresting" hunks, where the merge took the entire
  # hunk from one parent.
  git show --cc 1e5e614
  # show the diff of the merge commit to each of its parents
  # individually
  git show -m 1e5e614

And of course you can use those options with "git log -p" to see all of the commits and what they did. You might also want to try "git log --graph" to show the structure (though it is pretty hard to read with the diffs included).

> I have a log file such as shown below (produced by "git log
> --full-history --name-status --parents --dense")
Doesn't --dense cancel out --full-history?
> I know that commit 693a2 had the correct files, but 1e5e6 does not.
> (It has an older version of the file).

Sounds like somebody botched the conflict resolution. Using the show commands above should show you what happened in that case. Though from the commit messages below, I don't see any mention of conflicts, which the merge should have put in the message automatically.

So it may be that the files simply didn't change in first parent branch, but somebody reverted them to old versions (or botched a different merge) in the merged-in branch, with the end effect of reverting during the merge.

If you're still confused after looking around more, and there is nothing secret in the repo, it might work to make the repo available and tell us what you expected to see in 1e5e6, and how it differed.

-Peff
Previous: Patrick DoyleNext: Patrick Doyle
Message 2 of 4 in “How to tell what paths changed in a merge?”
  1. Patrick DoyleMar 28, 2011
  2. Jeff KingMar 28, 2011
  3. Fwd: How to tell what paths changed in a merge?Patrick Doyle, Mar 29, 2011
  4. Patrick DoyleMar 29, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.