One can rename a file with git mv
however, if you try to use this technique to change the case of the filename it will fail and you’ll get fatal: destination exists. I prefer to keep all my filenames lowercase, so getting this to work is important to me.
If I modified the filename case from the OS but not through git, git would fail to detect the change.
How to Change the Case of a Filename within Git
As with any filename change, we want to do this as a separate commit.
To insure git detects the change, we’re going to change to a temporary filename and then back to our desired filename with the case change.
git mv FileName.txt filename.tmp
git mv filename.tmp filename.txt
git add filename.txt
gc -m 'case change of filename'
Photo from Little Visuals
Leave a Reply