Chuck Conway

In The craft

Case Sensitivity with Windows and Git

December 12, 2014 · 2 minute read

GitOnWindowsWhen working on Windows it’s easy to forget about Git being case-sensitive. Normally, it’s not an issue; however, sometimes it can bite you.

The scenario goes like this: There are two Git repositories. One locally and one in the cloud (to the cloud!). The local Git repo is on Windows, a case-insensitive system. The other is in the cloud on Linux, a case-sensitive system. Can you feel the suspense building?

A new directory called “Password ” is created. It’s committed and pushed to the cloud Git repo. A short time later, it’s realized the directory name is wrong. It’s really suppose to be named “password”. This is a simple problem. Simply rename the directory to “password”.

This is where things go awry. Windows does not consider renaming a folder from “Password” to “password” a significant event. Rightly so, with Windows being a case-insensitive system. In the case-sensitive world it matters a whole heck of a lot. Git shell for Windows does not register the renaming as a change — nothing is queued to be committed. This leaves the local and remote repository out of sync. I can only surmise that Windows does not trigger an event when the folder’s name changes only by case.

Re-syncing the names is a simple two step process:

  1. git mv casesensitive Temp
  2. git mv Temp CaseSensitive