How to make git case sensitive for filenames

Every developer has had a point of time in their life when they have changed the name of a file from filename.ext to Filename.ext (Notice the different case, if you haven’t already)

But wait, if you have already committed filename.ext, then chances are that git will not recognize that the case of the file has changed and will not update it in the filesystem. This can cause confusion if you are expecting the filename to be in different case in a custom script that you wrote.

If there is a need to update the file with the new case, then here is what you need to do:

You need to make git case sensitive for your filename. Simply run the following command:

git config core.ignorecase false

From the git config documentation:


If true, this option enables various workarounds to enable git to work better on filesystems that are not case sensitive, like FAT. For example, if a directory listing finds makefile when git expects Makefile, git will assume it is really the same file, and continue to remember it as Makefile.

The default is false, except git-clone(1) or git-init(1) will probe and set core.ignorecase true if appropriate when the repository is created.