knipknap knipknap - 2 months ago 5
Git Question

"git describe" ignores a tag

In the following lines:

$ git tag -n1
v1.8 Tagged the day before yesterday
v1.9 Tagged yesterday
v2.0 Tagged today
$ git describe
v1.9-500-ga6a8c67
$


Can anyone explain why the v2.0 tag is not used by "git describe", and how to fix this? The v2.0 tag is already pushed, so I am guessing that I can't just delete and re-add it.

Answer

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 additionial tag message it's an annotated tag.