Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

git

People also ask

Can I rename a git directory?

To rename any file or folder, use git mv command which takes two arguments. The first argument is the source and the second is the destination. We can easily rename any file using the git command and the new name will be assigned to that file.


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"


You can also change this sensitivity in the git configuration.

git config core.ignorecase false