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

merge doesn't remove files

From
Gerrit Pape <pape@smarden.org>
Date
Feb 3, 2007, 22:48 UTC
Message-ID
<20070203224819.20131.qmail@b1b53206edee41.315fe32.mid.smarden.org>
Hi, please see http://bugs.debian.org/403104

Shouldn't git remove the original file after merging a commit that moved the file away? Here's a simple test case:

$ mkdir repo && cd repo
$ git init-db
defaulting to local storage area
$ echo a >foo && git add foo
$ git commit -a -m'add foo'
Committing initial tree 86de5e13286a8449a8a706a58e63be6781770b12
$ git branch b  
$ git mv foo bar
$ git commit -a -m'move foo'
$ git checkout b
$ echo ttt >>foo
$ git commit -a -m'change foo'
$ git pull . master
Trying really trivial in-index merge...
fatal: Merge requires file-level merging
Nope.
Merging HEAD with adc07a8eac73cdb1cb3764ec50747556ed2abc99
Merging:
92eff19 change foo
adc07a8 move foo
found 1 common ancestor(s):
ba043e5 add foo
Merge made by recursive.
 foo => bar |    0 
 1 files changed, 0 insertions(+), 0 deletions(-)
 rename foo => bar (100%)
$ git status
# On branch refs/heads/b
# Untracked files:
#   (use "git add" to add to commit)
#
#       foo
nothing to commit
$ ls
bar  foo
$ 
Thanks, Gerrit.
Next: Junio C Hamano
Message 1 of 6 in “merge doesn't remove files”
  1. Gerrit PapeFeb 3, 2007
  2. Junio C HamanoFeb 4, 2007
  3. Junio C HamanoFeb 4, 2007
  4. Shawn O. PearceFeb 4, 2007
  5. Linus TorvaldsFeb 4, 2007
  6. Shawn O. PearceFeb 4, 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.