In a Unix or GNU scripting environment (e.g. a Linux distro, Cygwin, OSX), what is the best way to determine whether the current checkout is a Git tag. If it is a tag, how c
You cannot determine if the current checkout “is a tag”. You can only determine if the current checkout was a commit that has tags.
The difference is: if there are several tags pointing to this commit, git can’t tell you which you used to checkout, nor if you actually used one to get there at all.
Jakub’s answer here based on git describe --exact-match (--tags) gives you “the first” of all the (annotated) tags.
And git describe sorts them like this: