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 can I determine the tag name?
One use of this technique would be automatically labeling a release (like svnversion would do with Subversion).
See my related question about programmatically detecting the Git branch.