从特定分支列出git中的标签 [英] Listing the tags in git from a specific branch

查看:66
本文介绍了从特定分支列出git中的标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用repo sync到存储库(从头开始),并传递了一个名为(mybranch)的分支.我通过使用以下命令在git中获得了标签列表:

I have used repo sync to a repository (from head) and have passed a branch named (mybranch). I got a list of tags in git by using:

git tag -l

然后借助正则表达式,我获得了与特定模式匹配的标签.

Then with the help of a regular expression I obtained the tags which match a specific pattern.

能否获得那些入围标签的分支名称,然后仅从特定分支中仅选择标签?

Is it possible to get the branch name of those shortlisted tags and then select only the tags only from a particular branch?

我看到了 git分支-r 命令,但它也可以与标签名称一起使用吗?

I saw git branch -r command but can it be used along with the tag name as well?

推荐答案

假设您想要引用标记所引用的提交的分支:

Assuming you want the branches which refer to a commit referred by a tag:

git branch --contains <tagname>

只需为您正在查找的分支的每个标签重复该命令即可

Just repeat the command for each tag you are looking the branch(es) of:

git tag -l 'example*' |xargs -n1 git branch --contains

请注意,标记可以引用任何对象,不仅是提交,而且'branch'命令只希望提交.

Be aware, that tags can refer to any object, not only commits, but the 'branch' command expects commits only.

这篇关于从特定分支列出git中的标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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