Issue with renaming a directory in git to lowercase while ignoreLowercase=True

You can also change this sensitivity in the git configuration.

git config core.ignorecase false

Example: if you are lower-casing Mydir

git mv src/Mydir src/mydirs

git mv src/mydirs src/mydir

git commit -m "Rename folder Mydir to mydir"

I've found a workaround. I'm not sure if there's a more elegant solution, but I have tested this and it does work. Because git continues to think that two files exist when only one does, I had to actually just copy the directory entirely, remove what git is tracking as a file, and then mv the copied directory back to the original.

(1) commit any files in dir that need to be commited.

(2) cp -r dir tempDir

(3) git add tempDir/

(4) git rm -r dir Dir

(5) git commit -m "Temporary rename of dir to tempDir"

(6) git mv tempDir mms

(7) git commit -m "Full rename from DIR to dir complete"

Tags:

Git