Cat.git / HEAD on Windows?

I'm trying to see where my HEAD is referencing the current commit that my working copy is pointing to, and I've googled for an hour, I couldn't find anything.

what is the cat .git/HEAD

equivalent command in windows? Thank!


source to share

2 answers

How to try this:

type .git\HEAD


This is similar to cat on Linux / Unix.

Windows paths use the backslash as opposed to the Unix / Linux slash. The forward slash in windows is commonly used to specify a command line argument to a program



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.



All Articles