Why doesn't git attempt to merge changes to renamed files?

git, merge

Solution

Because there is actually no concept of first-class rename operation in git, it just "detects" renames using a threshold for file differences. Your files are probably too different.

Try merging with: `git merge master -s recursive -X rename-threshold=5%`

Problem

Let's say I have a file that's - Modified in master - Modified in a feature branch - Renamed in a feature branch When I try to merge up from master to the feature branch, merge fails with CONFLICT (modify/delete): X deleted in HEAD and modified in origin/master. Version origin/master of X left in tree. I understand that there is a conflict, but why doesn't it even try to merge changes and place conflict markers in the file? Previous answers seem to imply that it should. All I get is two different versions of the file, where I have to figure out the difference manually and port changes line by line from master version to my version. Steps to reproduce: ``` git init touch a git add a git commit -m 'initial import' git checkout -b feature1 echo feature1 > a git add a git commit -m feature1 git mv a b git commit -m feature1 git checkout master echo bugfix > a git add a git commit -m bugfix git checkout feature1 git merge master ```

Original source

Related problems