Cat.git / HEAD on Windows?
You are probably better off not looking at anything directly in the .git directory.
This is somewhat more annoying, as some forms of the command work differently if you're in a separate head, but the following are safer and easier to parse normally (and also portable).
git symbolic-ref HEAD git name-rev HEAD git rev-parse HEAD
A character ref will output ref if it exists, but return an error if in a separate head.
source to share