For releases I usually tag with something like v1.1.0. During my build script I am creating a fwVersion.c file that contains the current git info. Currently, I have commit
I found the combo of both top answers to give me what i wanted like so:
git describe --tags --exact-match
This gives you the tag that is ONLY for that commit and for ones without annotation. Useful when you want to find tags and not worry about stripping the formatting off then (for Jenkins for example).
eg. $ git describe --tags --exact-match head~2
Gives you:
$ ReleaseBeta