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

Re: unexpected git-merge result

From
Dmitry Potapov <dpotapov@gmail.com>
Date
Feb 22, 2010, 05:44 UTC
Message-ID
<20100222054425.GC10191@dpotapov.dyndns.org>
In-Reply-To
<loom.20100220T031401-572@post.gmane.org>
On Sat, Feb 20, 2010 at 03:45:09AM +0000, Dale Rowley wrote:
Show 15 quoted lines
> 
> You're exactly right. I overlooked the cherry-pick, which clears things up a
> bit. But the basic problem remains:
> 
> A----D---E---H
>  \          /
>   B--D'----G
> 
> G only removed a few of the lines that were brought over in the cherry-pick
> (D'), so it was surprising when they re-appeared in H. Intuitively, one would at
> least expect a conflict in H since D'+G is asserting that these lines should not
> exist, whereas D (on the other branch) is asserting that they should. I can see
> how it would be difficult to make git-merge account for this though, so maybe
> this is just a subtle gotcha when merging branches? Is there an easy way to
> avoid this gotcha?

git merge does 3-way merge, which means that it does not look at whole history but only on the current state and the merge base. So, if you look at changes between A and G then those lines were not touched, and A-E adds those lines, thus the end result is that these lines are added.

Dmitry
Previous: Dale RowleyNext: Dale Rowley
Message 4 of 5 in “unexpected git-merge result”
  1. Dale RowleyFeb 19, 2010
  2. Junio C HamanoFeb 19, 2010
  3. Dale RowleyFeb 20, 2010
  4. Dmitry PotapovFeb 22, 2010
  5. Dale RowleyFeb 22, 2010

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.