If you need to get the current commit, but don’t want to run git rev-parse HEAD
, you can get it from .git/refs/heads/master
where master
is the branch you are interested in.
Side note: use git rev-parse --short HEAD
to get the short version without needing to do substrings.