This question can be answered with one of git's plumbing commands, rev-parse.
rev-parse
$ git rev-parse --abbrev-ref HEAD
The --abbrev-ref flag tells git-rev-parse to give us the short name for HEAD instead of the SHA.
--abbrev-ref
git-rev-parse
HEAD
sourcearrow-up-right
Last updated 4 years ago