Is HEAD in git case insensitive on all platforms?

The case-sensitivity of HEAD is depending on the case-sensitivity of file system of the OS.

When you checkout HEAD, git actually looks for a file named "HEAD" under the folder .git. If you type HEAD in small letters, git looks for the file name with small letters. You can see the .git/HEAD file actually contains the hash code of the commit HEAD pointing to.

Because of this, the typical case-sensitivities of HEAD are:

  • Case-sensitive on Linux
  • Case-insensitive on Windows, MacOS

HEAD is case-sensitive on Linux.

For example:

$ git checkout head
error: pathspec 'head' did not match any file(s) known to git.
$ git checkout HEAD
Your branch is up-to-date with 'origin/master'.

Git version 1.9.1 on Ubuntu 14.04.

Tags:

Git