Search code examples
gitmsysgit

git merge does not remove files


I try to merge two branches, say br2 into br1 (on br1 git merge br2). 1.txt is a file which is present on both branches. In br2 this file is moved into another directory 1.txt is now in sub/1.txt. After merge is done I have two files 1.txt in br1: 1.txt and sub/1.txt, that is strange.

If I apply commit which moved 1.txt file with cherry-pick file is correctly moved to subdirectory.

Why is not it moved (but copied) into subdirectory during merge?

$ git --version
git version 1.8.1.1

Solution

  • I found answer. There was a problem with merge base. Basically diff from head to merge-base did not contain file deletion, so that is why git removed files with cherry pick and did not with merge.