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

前端 未结 24 2391
你的背包
你的背包 2020-11-22 17:04

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:



        
24条回答
  •  遥遥无期
    2020-11-22 17:20

    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
    

提交回复
热议问题