ecl0
ecl0

Reputation: 435

Latest git tag not appearing with git describe command

Currently our CI builds on the latest git tag, git describe --tags $(git rev-list --tags --max-count=1)

We have a scenario where a remote dev is tagging but the tag is only appearing with the command

git describe --abbrev=0

the tag is not appearing with the first command.

Upvotes: 1

Views: 1754

Answers (2)

danglingpointer
danglingpointer

Reputation: 4920

There are several ways to get the git latest tag from the current branch your in. I just mentioned only simple approaches.

Answer to your question most simple way is to use this will provide the latest git tag

 $ git describe --tags

and another simple approach which you already mentioned your doing that

$ git describe --tags --abbrev=0

Upvotes: 0

Mark Adelsberger
Mark Adelsberger

Reputation: 45649

git rev-list --tags will list every commit reachable from any tag, in reverse chronological order. Adding --max-count=1 limits the output to the first commit that would otherwise be displayed. So that command shows the newest commit that has a tag.

If any user tags a commit, but it's not newer than every commit that already has a tag, it won't show. I'm guessing, for your usage, that this sounds ok -- though do note that's newest commit, not newest tag.

Your remote dev, though... is his clock in sync with your local clock?

You might be able to improve the situation by adding the --topo-order flag, which ensures that a commit cannot be listed until all of its children have been listed.

Upvotes: 1

Related Questions