How can I get the latest tag name in current branch in Git?

To get the most recent tag (example output afterwards):

git describe --tags --abbrev=0   # 0.1.0-dev

To get the most recent tag, with the number of additional commits on top of the tagged object & more:

git describe --tags              # 0.1.0-dev-93-g1416689

To get the most recent annotated tag:

git describe --abbrev=0

Leave a Comment