Kennis Blogs Stop ignoring my capitals Git!

Stop ignoring my capitals Git!

We use Git as our version control system, and recently, I had an issue while refactoring some classes in a Java project. If I changed a filename by changing a letter to a capital, Git would simply not pick up the change. For example:

 

$ mv Camelcase.java CamelCase.java
$ git status
No changes detected

 

I quickly fixed it like this:

$ mv CamelCase.java CamelCased.java
$ git commit -am "trying to commit a capital change"
$ mv CamelCased.java CamelCase.java
$ git commit -am "committed capital change"

 

This just did not feel right... there had to be a better way! Searching on Google I quickly found out about the option "core.ignorecase". This option is useful for case insensitive filesystems, but that's not the case at Avisi... you see we're all hipsters here so we use Macs...

 

When I searched in the repository for .git/config I quickly found this:

[core]
ignorecase = true

 

So I changed it to:

[core]
ignorecase = false

 

This fixed all the issues... I did also set it globally:

$ git config --global core.ignorecase false

 

I just hope this saves someone else a half an hour!