我在做
$ git tag
current
tag_example_to_test_task
$ git checkout tag_example_to_test_task
...
HEAD is now at 75fdde3... commit comment text example
$ git name-rev --name-only --tags HEAD
current
$ git describe --exact-match --tags
current
我需要用这样的命令结束执行序列:
$ git "some command here"
tag_example_to_test_task
该怎么做?如何获取当前 checkout 标签的标签名称?
最佳答案
我觉得
git log -n 1 --pretty=format:'%d'
应该可以解决问题。
但是,它会显示所有分支的名称和当前修订版的标签。我认为不可能只获得用于检查修订的单个标签。
关于git - 获取 checkout 修订版的 git 标签?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15703253/