如何列出指向git中特定提交的所有标记 [英] How to list all tags pointing to a specific commit in git

查看:116
本文介绍了如何列出指向git中特定提交的所有标记的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看过命令 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中特定提交的所有标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆