git describe --tags behaviour

Viewed 272

I want to build a build flow in VS and want to use the tag.

I'm using git describe --tags to get the latest tag, but it's not always working. Here's an example:

me@pc MINGW64 /d/temp (master)
$ git tag
TAG_1
TAG_2
TAG_3
TAG_4

me@pc MINGW64 /d/temp (master)
$ git describe --tags
TAG_4

me@pc MINGW64 /d/temp (master)
$ git tag TAG_5

me@pc MINGW64 /d/temp (master)
$ git tag TAG_6

me@pc MINGW64 /d/temp (master)
$ git describe --tags
TAG_4

me@pc MINGW64 /d/temp (master)
$ git describe --abbrev=0 --tags
TAG_4

me@pc MINGW64 /d/temp (master)
$ git tag
TAG_1
TAG_2
TAG_3
TAG_4
TAG_5
TAG_6

me@pc MINGW64 /d/temp (master)
$ git --version
git version 2.33.1.windows.1

I wanted the describe --tags command to display TAG_6 after I'd added that one. Sometimes it works, sometimes it gets confused like this. It's a local Windows 10 repo in the test.

How can I reliably get the latest tag on the branch?

Thanks in advance. Steve

0 Answers
Related