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

git merge bug: creating new files in one branch in a directory that is renamed in another

From
LSLiraz Siri <liraz.siri@gmail.com>
Date
Jan 21, 2007, 08:20 UTC
Message-ID
<45B3224B.3020800@gmail.com>
Hey all,

I'm running a few tests to figure out when git does the right thing on merges, and I've discovered that git does not do the right thing if you are creating new files in one branch in a directory that is renamed in another.

Merging edits of files in dir/ in one branch and renaming dir/ to newdir/ in another branch works, but if you create files in the renamed dir/ then after the merge they will still remain in dir/, rather than newdir/.

Here is some example output from a test merge:
$ git-merge XXX HEAD fork
Trying really trivial in-index merge...
fatal: Merge requires file-level merging
Nope.
Merging HEAD with 68aaa44a864cde7a1b83a65a8d5c70cc6c42ac7b
Merging:
85ba656 liraz renamed t to t2
68aaa44 created t/newfile
found 1 common ancestor(s):
9e42cd6 xxx
Merge made by recursive.
 t/newfile |    1 +
 t2/liraz1 |    1 +
 2 files changed, 2 insertions(+), 0 deletions(-)
 create mode 100644 t/newfile

Cheers, Liraz

Next: Shawn O. Pearce
Message 1 of 3 in “git merge bug: creating new files in one branch in a directory that is renamed in another”
  1. Liraz SiriJan 21, 2007
  2. Shawn O. PearceJan 21, 2007
  3. Johannes SchindelinJan 21, 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.