Why is git describe returning a super old tag?

188 Views Asked by At

I’m fairly new to using git describe.

Shouldn’t git describe, return the last tag that you get from git tag? I currently get tag-release-1.0.1-2107-g4a123293e (from 4yrs ago) returned when I do git describe. I looked at this question, but I get the same result when I run it with --tags.

I ask because git tag for me returns something like this. I suppose because we changed the tagging convention the sorting is messed up and so is git describe.

3.23
3.24
...
4.14
4.15 (most recent tag)
...
tag-release-1.0.0
tag-release-1.0.1 (from 4 yrs ago)

Is my thought process correct here?

1

There are 1 best solutions below

1
mfaani On BEST ANSWER

We've been tagging on release branches. What exacerbates the problem is that almost every time we cherry-pick into the release branches as well. ‍♂️

Upon every commit to a release branch, we re-tag.

Given that the tags happen after commits on release branch, example on release/4.15.0, then since the main (master) branch doesn't have those commits, git describe won't be able to bridge the gap.

Solution:

Tag on main branch only.