How do you get the sha1 hash for references like HEAD
, HEAD^^^
, HEAD~8
?
I know I can hack up git show
to get what I want, but it spits out a bunch of other stuff I don't want. Eg.
git show HEAD^^ --pretty=format:%H | head -n1
What is a simpler command that is more direct to the intent of what I am trying to achieve?
You want to use:
git rev-parse HEAD