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

How to find and analyze bad merges?

From
Nnorbert.nemec <norbert.nemec@native-instruments.de>
Date
Feb 2, 2012, 08:10 UTC
Message-ID
<jgdgcv$h8n$1@dough.gmane.org>
Hi there,

a colleague of mine happened to produce a bad merge by unintenionally picking the version of the remote branch ("R") for all conflicting files. Effectively, he eliminated a whole bunch of bugfixes that were already on his local branch ("L").

Obviously this was a mistake on his side, but hey: everyone makes mistakes. The real problem is to find this problem afterwards, possibly weeks later, when you suddenly realize that a bug that you had fixed suddenly reappears.

A "git log" on the whole repository shows both branches R and L. A "git show" on the bugfix commit shows the bugfix as you expect it.

BUT: A "git log" on the file itself shows neither the problematic merge nor the bugfix commit. Git considers the merge of this file trivial because the content is identical to that of parent R. Therefore, whatever happened on branch L is not considered relevant history of the file.

FURTHERMORE: A "git show" of the merge itself does not show the conflicting file either. Obviously, "git show" on a merge decides which files are relevant not based on conflicts but based on resolutions.

To sort out what happened, you first need to have a suspicion and then dig fairly deep in the manuals to set the correct options to show what happened.

I think, both "git log" and "git show" should by default be a bit more 
conservative in hiding "insignificant" merges:
* In "git log" a branch should only be hidden if it never touched the file.
* In "git show" a merge should display all files that did have a 
conflict independent of the resolution. (I am open to discuss whether 
auto-resolvable conflicts should be displayed by default. Non-trivial 
conflicts definitely should)

Greetings, Norbert

Next: Junio C Hamano
Message 1 of 11 in “How to find and analyze bad merges?”
  1. norbert.nemecFeb 2, 2012
  2. Junio C HamanoFeb 2, 2012
  3. norbert.nemecFeb 2, 2012
  4. Junio C HamanoFeb 2, 2012
  5. norbert.nemecFeb 2, 2012
  6. Norbert NemecFeb 2, 2012
  7. David BarrFeb 2, 2012
  8. Jonathan NiederFeb 2, 2012
  9. norbert.nemecFeb 2, 2012
  10. Neal GroothuisFeb 2, 2012
  11. norbert.nemecFeb 2, 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.