问题描述
我看过命令 git describe
和 git-name-rev
,但我没有设法让它们列出多个标签。
示例:我有sha1 48eb354,我知道标签A和B指向它。所以我想要一个产生类似于A,B的输出的git命令 git {something} 48eb354
。我不知道相对于其他标签或分支的引用是否完全匹配标签。 show-ref --tags -d | grep ^ 48eb354 | sed -e's,。* refs / tags / ,,'-e's / \ ^ {} //'
应该适用于轻量级和带注释的标记。
I have seen the commands git describe
and git-name-rev
but I have not managed to get them to list more than one tag.
Example: I have the sha1 48eb354 and I know the tags A and B point to it. So I want a git command git {something} 48eb354
that produce output similar to "A, B". I am not interested in knowing references relative other tags or branches just exact matches for tags.
git show-ref --tags -d | grep ^48eb354 | sed -e 's,.* refs/tags/,,' -e 's/\^{}//'
should work for both lightweight and annotated tags.
这篇关于如何列出指向git中特定提交的所有标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!