git 如何列出包含提交的所有标签?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7923091/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to list all tags that contain a commit?
提问by atx
This question is similar to How to list all tags pointing to a specific commit in git, but with one difference: I wish to search for all tags that contain a specific commit within the tree of each tag, not specifically the files marked in the tag itself (in this case, only the Makefile change has been tagged).
这个问题类似于如何在 git 中列出指向特定提交的所有标签,但有一个区别:我希望在每个标签的树中搜索包含特定提交的所有标签,而不是专门在标签中标记的文件本身(在这种情况下,仅标记了 Makefile 更改)。
回答by amalloy
git tag --contains <commit>
回答by VonC
Note that you need git 2.0.x (Q3 2014) in order to list all tags for a certain commit if you have a large repo
请注意,如果您有大型仓库,您需要 git 2.0.x(2014 年第 3 季度)才能列出某个提交的所有标签
See commit cbc60b6by Jean-Jacques Lafay (lanfeust69
):
见提交cbc60b6由让-雅克·Lafay( )lanfeust69
:
git tag --contains
: avoid stack overflow
git tag --contains
: 避免堆栈溢出
In large repos, the recursion implementation of
contains(commit, commit_list)
may result in a stack overflow. Replace the recursion with a loop to fix it.This problem is more apparent on Windows than on Linux, where the stack is more limited by default.
在大型 repos 中, 的递归实现
contains(commit, commit_list)
可能会导致堆栈溢出。用循环替换递归来修复它。这个问题在 Windows 上比在 Linux 上更明显,默认情况下堆栈受到更多限制。
See also this thread on the msysGit list.
另请参阅msysGit 列表上的此线程。
回答by manojlds
git tag --contains <sha1_hash>
should work
应该管用