"git describe" ignores a tag

When this happened to us, it was a case of two tags applied for the same commit. You can find if this is the case by running

# git log --oneline --decorate=short
deba4b4 (tag: v1.1.0.20.0, tag: v1.1.0.19.0) 001 New buildnumber

Here there are two tags, one for version 19 and other for 20. 20 was tagged after 19, but for the same commit. In this case describe returned

# git describe --tags
v1.1.0.19.0

I don't know why it did this, but this is how it seems to work with duplicate tags.

Another case where this might happen is if you have a tag that is more "near" to you in a branch. That case has been explained in this blog post.


git describe uses only annotated tags by default. Specify the --tags option to make it use lightweight tags as well.

Make sure you've checked out the correct commit (git rev-parse HEAD). Annotated tags are created with git tag -a. If you do git show <tagname> and you see the commit only, it's a lightweight tag; if you see an additional tag message, it's an annotated tag.