Human readable format
For the last commit (i.e. HEAD):
git log -n1 --oneline --decorate
Or specify a specific commit:
git log -n1 --oneline --decorate fd88
gives:
fd88175 (HEAD -> master, tag: head, origin/master) Add diff-highlight and icdiff
To get only the / refs / remotes tags, pass this through sed :
$ git log -n1 --oneline --decorate | sed 's/.*(\(.*\)).*/\1/'
HEAD -> master, tag: head, origin/master
For bonus points, add an alias for this:
decorations = "!git log -n1 --oneline --decorate $1 | sed 's/.*(\\(.*\\)).*/\\1/' #"
source share