获取已检出修订的git标签? [英] Get git tag of checked out revision?
本文介绍了获取已检出修订的git标签?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在做
$ 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
我需要使用以下命令结束执行序列:
I need to end execution sequence with some command like this:
$ git "some command here"
tag_example_to_test_task
该怎么做?如何获取当前已签出标签的标签名称?
How to do that? How to get tag name of current checked out tag?
推荐答案
我认为
git log -n 1 --pretty=format:'%d'
应该可以解决问题.
但是,它将为您显示当前修订版所具有的所有分支的名称和标签.我认为不可能仅获得用于签出修订版的单个标签.
However, it'll show you names of all branches and tags your current revision has. I don't think it's possible to get just the single tag that have been used to check out the revision.
这篇关于获取已检出修订的git标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文