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

confused about a conflict during octopus merging

From
MKmartin f krafft <madduck@madduck.net>
Date
Oct 9, 2007, 00:31 UTC
Message-ID
<20071009003156.GA30498@lapse.madduck.net>
Dear list,
I am a little confused why the following yields a conflict:
$ git init
$ touch a; git add a; git commit -ma
Created initial commit 0ba90cc: a
 0 files changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 a
  # create merger branch for later
$ git branch merger
  # create a file
$ date > d; git add d; git commit -md1
Created commit 89d22eb: d
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 d
  # branch off a second branch and populate it
$ git checkout -b second
Switched to a new branch "second"
$ touch b; git add b; git commit -mb
Created commit 7370737: b
 0 files changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 b
  # modify file changed in previous commit
$ git checkout master
Switched to branch "master"
$ date >> d; git add d; git commit -md2
Created commit bb5f1b4: d2
 1 files changed, 1 insertions(+), 1 deletions(-)
Now the tree structure is
  x -- master: d2
  | x -- second: b
  |/
  x d1
  |
  x -- merger: a
  # now octopus-merge master+second into merger
$ git checkout merger
Switched to branch "merger"
$ git merge master second
Trying simple merge with bb5f1b4f3a8cbfcbc9dbc97cc823f3ca05db2db1
Trying simple merge with 7370737ff3aa6540a425db015e194766d2cbda2e
Simple merge did not work, trying automatic merge.
Added d in both, but differently.
error: Could not read .merge_file_mCwa4W
ERROR: Merge conflict in d
fatal: merge program failed
Automatic merge failed; fix conflicts and then commit the result.

I don't understand why these conflict. I mean, sure, it makes sense: after merging master, file d is at d2. Now when merging second, it tries to replace d by its ancestor, d1.

What I don't understand is why Git does not understand that commit d is part of the path of arriving at d2, so when 'second' is merged, Git *should* really see that the change to file d in 'second' (d1) is an ancestor of the already present d2 commit, and *not* conflict.

What am I misunderstanding here?
Thanks,
-- 
martin;              (greetings from the heart of the sun.)
  \____ echo mailto: !#^."<*>"|tr "<*> mailto:" net@madduck
 
"distrust all those who love you extremely
 upon a very slight acquaintance and without any visible reason."
                                                  -- lord chesterfield
 
spamtraps: madduck.bogus@madduck.net
Next: Linus Torvalds
Message 1 of 3 in “confused about a conflict during octopus merging”
  1. martin f krafftOct 9, 2007
  2. Linus TorvaldsOct 9, 2007
  3. martin f krafftOct 9, 2007

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.