我正在做
$ 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如何做到这一点?如何获取当前已检出标签的标签名称?
发布于 2013-03-29 20:37:59
我认为
git log -n 1 --pretty=format:'%d'应该能行得通。
但是,它将显示您当前修订的所有分支和标记的名称。我认为不可能只获得用于检查修订的单个标记。
发布于 2013-09-06 22:39:05
要找到是什么让您获得了当前提交,您可以使用
git reflog | sed q要查找您的最后一次结账:
git reflog | sed '/ checkout: /! d; q'这会让你得到像这样的东西
b836444 HEAD@{7}: checkout: moving from AMFD to testing显示您自执行git checkout testing以来已经添加了七个提交。
发布于 2013-03-30 10:29:18
如果您需要当前版本的详细信息,请使用git describe。它会告诉你最后一个标记和之后的提交次数。人类可读的,不是真正的程序消费。
https://stackoverflow.com/questions/15703253
复制相似问题