Git: Solve Letter Case Problem

There are time that the git show some problem with case


The file system show: my_folder

Git track: My_folder

And also the remote repos store My_folder


We already have my_folder.

We don’t know why git track My_folder .

We don’t know how to change and add it to git.


Mac and Window file system doesn’t know upper and lower case.

Sometimes we got wrong case so it cannot be managed by file system.

We will manage by git tracking instead.

Git knows letter case.

*Bonus: you can prove this by try naming two folder/file with the same name but different case. This is not possible.


First you have to list out what git is actually tracking

$ git ls-files
// looking for My_folder

Yep. It’s here then we will change it with git mv

$ git mv ./My_folder ./my_folder

Now we have to do some trick with mv

$ git mv ./My_folder temp_folder_name
$ git mv temp_folder_name ./my_folder
// Working !

Now git know my_folder and you can push it to the remote repository.

Cheers !