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

Re: commit gone after merge - how to debug?

From
Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Date
Nov 26, 2012, 14:50 UTC
Message-ID
<vpqa9u4pgew.fsf@grenoble-inp.fr>
In-Reply-To
<CAO1Khk8=nrKknfqY-k6XaGPDbLrHyrK-8fxfB7XXUWeB7L4EUA@mail.gmail.com>
[ Jumping back in time ]
Igor Lautar <igor.lautar@gmail.com> writes:
Show 9 quoted lines
>> Try this:
>>
>> commit=<sha1 of your merge commit>
>> # Show diff with first parent:
>> git diff "$commit" "$commit"^1
>> # Show diff with second parent:
>> git diff "$commit" "$commit"^2
>
> Yes, change is shown in commit^2, but actual file after merge does not have it.

My commands had the wrong order. It should have been git diff "$commit"^2 "$commit". So, it showed the reverse of the modification introduced by the commit. If you see your change here, it means the change was reverted by the merge.

My understanding of the situation up to now is:
M
|\
A C
|/
B
($commit = M, $commit^1 = A and $commit^2 = B)

Your file had a content (say, "old") at revision B. It changed content (say, to "new") at revision C, and at some point. A did not change it so it had the content "old". Then you merged, expected the merge commit M to get content "new", and actually got "old".

So, your history looks like:
M (old)
| \
|  `---.
|       \
A (old)  C (new)
|       /
|  .---'
| /
|/
B (old)
and "git diff C M" shows the diff between new and old.

Something went wrong during the merge, I guess it used an ancestor (B above) that had "new" as content. I don't see how this happened (rather clearly, your history is more complex than my example above), but "GIT_MERGE_VERBOSITY=5 git merge" will show you which common ancestor was used, it may help.

What's possible is that someone had already merged the branch containing "new", got conflicts, and resolved it in favor of "old" somewhere in the history of your master branch.

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
Previous: Igor LautarNext: Igor Lautar
Message 11 of 13 in “commit gone after merge - how to debug?”
  1. Igor LautarNov 26, 2012
  2. Tomas CarneckyNov 26, 2012
  3. Matthieu MoyNov 26, 2012
  4. Igor LautarNov 26, 2012
  5. Matthieu MoyNov 26, 2012
  6. Igor LautarNov 26, 2012
  7. Matthieu MoyNov 26, 2012
  8. Igor LautarNov 26, 2012
  9. Matthieu MoyNov 26, 2012
  10. Igor LautarNov 26, 2012
  11. Matthieu MoyNov 26, 2012
  12. Igor LautarNov 26, 2012
  13. Igor LautarNov 26, 2012

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.