git merge fails with "Untracked working tree file" on case change

Viewed 2703

On Mac OS X, I have two branches - say A and B - and I want to merge A into B. When I try to do git merge A on B, I get:

error: Untracked working tree file 'path/file.php' would be overwritten by merge.  Aborting

This is caused by the fact that some change in A renamed the file - i.e. B has file path/File.php while A has it renamed to path/file.php. Since Mac OS X filesystem is case insensitive, this probably confuses git. Is there a way to make git do the merge properly?

Update: for clarification, branch B does not have any uncommitted changes and the file in question is tracked in both branches (under different names, of course).

4 Answers
Related