I recently discovered that there are a couple folders in my solution that have two distinct paths in Git (GitHub shows two separate folders), one being FooBar
and the other being Foobar
. This is because some files were registered with the former folder name as their path, and some with the latter.
This was discovered locally (in Windows) by configuring Git to not ignore case: git config core.ignorecase false
I took a stab at fixing this by deleting the whole folder, committing, then re-adding the folder and committing again. This fixed the problem, but the files that got their paths changed lost their Git History. Running gitk
against the new path for these files showed just the one commit. Running gitk
against their old path revealed their whole history.
Next stab: Use git mv
to move the file:
git mv Foobar/file.txt FooBar/file.txt
This yields the error:
fatal: destination exists, source=Foobar/file.txt, destination=FooBar/file.txt
And if I try deleting the file first, of course Git complains that the source file doesn't exist.
Then I discovered Git doesn't complain about the destination already existing if you add -f
to the mv
command. However, after committing that rename, gitk
shows that the history got severed anyway!
I even attempted to do the three step dance described here but this was just another way of doing the -f
. Same result.
Basically I just want to move a file from Foobar/file.txt
to FooBar/file.txt
in a case-insensitive operating system in some way, while preserving Git history. Is this possible?