Git – Careful with capital letters on Windows

I ran into an interesting little problem the other day.

A colleague asked why he couldn’t push his changes to Stash (Atlassians Enterprise git repository).

He has his Master branch updated from a feature-branch but couldn’t get Stash to accept his push.

The reason was that he had a branch called Master (notice the capital M”). This seemed to confuse “git for Windows” or Stash to no end.

The cure was to

  • delete the Master-branch and pull it from Stash.
  • Do the merge again
  • Then push

My guess to the reason for the problem is the difference between Windows and Unix/Linux regarding letter case. On Windows case is ignored in filenames, whereas they matter a great deal on Unix/Linux systems. If you create a file “Master” and a file “master” on Unix/Linux you’ll get two files. On Windows only one will survive …

Try this in Windows Explorer and you get the following
Master master

And since git uses the filesystem (where else would it put the information) it will overwrite the original “master” information. (Git has Linux origins. And like all things *nix the user is expected to know what his/she is doing … aka. Unix user-friendliness: “If you know what you’re doing: go ahead, I won’t stop you. But if you don’t know perhaps you should GET YOUR HANDS OFF THE KEYBOARD”). I like that attitude, but not everyone does.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.