Git是否可以检索仅存在于某个分支中的标签列表? [英] Is it possible with Git to retrieve a list of tags that exist only in a certain branch?

查看:23
本文介绍了Git是否可以检索仅存在于某个分支中的标签列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否可以在 Git 中检索标签列表(很像 git tag 命令的结果),但该列表应该仅限于某个分支.

I would like to know if it's possible in Git to retrieve a list of tags (much like the result of the git tag command), but the list should be limited only to a certain branch.

如果可能的话,谁能解释一下这是怎么做到的?也许有一些模式匹配的魔法?

If this is possible, can anyone explain how this is done? Perhaps with some pattern-matching magic?

推荐答案

另一种方法可以使用新的 git 标签选项 --merged(在 git 2.7+ 中,2015 年第四季度)

Another approach would be possible with the new git tag options --merged (in git 2.7+, Q4 2015)

git tag --merged <abranchname>

请参阅 commit 5242860,...(2015 年 9 月 10 日)由 Karthik Nayak (KarthikNayak).
(由 Junio C Hamano 合并 -- gitster -- in 提交 8a54523,2015 年 10 月 5 日)

See commit 5242860, ... (10 Sept 2015) by Karthik Nayak (KarthikNayak).
(Merged by Junio C Hamano -- gitster -- in commit 8a54523, 05 Oct 2015)

tag.c:实现--merged"和--no-merged"选项

tag.c: implement '--merged' and '--no-merged' options

使用 'ref-filter' API 实现 '--merged' 和 '--no-merged' 选项到 'tag.c'.

Use 'ref-filter' APIs to implement the '--merged' and '--no-merged' options into 'tag.c'.

  • '--merged' 选项允许用户仅列出合并到命名提交中的标签.
  • --no-merged"选项允许用户仅列出未合并到命名提交中的标签.
  • The '--merged' option lets the user to only list tags merged into the named commit.
  • The '--no-merged' option lets the user to only list tags not merged into the named commit.

如果没有提供对象,则假定 HEAD 为对象.

If no object is provided it assumes HEAD as the object.

这篇关于Git是否可以检索仅存在于某个分支中的标签列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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