Show which git tag you are on?

前端 未结 6 2137
既然无缘
既然无缘 2020-12-07 06:46

I\'m having trouble finding out which tag is currently checked out.

When I do:

git checkout tag1
git branch

I can\'t seem to find

6条回答
  •  死守一世寂寞
    2020-12-07 07:33

    git describe is a porcelain command, which you should avoid:

    http://git-blame.blogspot.com/2013/06/checking-current-branch-programatically.html

    Instead, I used:

    git name-rev --tags --name-only $(git rev-parse HEAD)
    

提交回复
热议问题