culebrón culebrón - 2 months ago 14
Git Question

How to get the latest tag name in current branch in Git?

What's the simplest way to get the most recent tag in Git?

git tag a HEAD
git tag b HEAD^^
git tag c HEAD^
git tag


output:

a
b
c


Should I write a script to get each tag's datetime and compare them?

JB. JB.
Answer

You could take a look at git describe, which does something close to what you're asking.