What\'s the simplest way to get the most recent tag in Git?
git tag a HEAD
git tag b HEAD^^
git tag c HEAD^
git tag
output:
Not much mention of unannotated tags vs annotated ones here. 'describe' works on annotated tags and ignores unannotated ones.
This is ugly but does the job requested and it will not find any tags on other branches (and not on the one specified in the command: master in the example below)
The filtering should prob be optimized (consolidated), but again, this seems to the the job.
git log --decorate --tags master |grep '^commit'|grep 'tag:.*)$'|awk '{print $NF}'|sed 's/)$//'|head -n 1
Critiques welcome as I am going now to put this to use :)