Git:如何找出标签在哪个分支上? [英] Git: How to find out on which branch a tag is?

查看:2234
本文介绍了Git:如何找出标签在哪个分支上?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正忙于一个有很多分支的项目,并且我有一个用于最后更改的标签,该标签是在其中一个分支上完成的。但是我不清楚这个标签在哪个分支上。

I'm currently busy with a project with a lot of branches and I have a tag for last changes which where done on one of the branches. But it's not clear for me on which branch this tag is.

如何找出标签在哪个分支上?

How to find out on which branch a tag is?

推荐答案

甚至更短:

git branch --contains tags/<tag>

(适用于任何树状参考)

(it works for any tree-ish reference)

如果您找到提交了标签的

 git rev-parse --verify tags/<tag>^{commit}
 # or, shorter:
 git rev-parse tags/<tag>~0

然后您可以找到< a href = https://stackoverflow.com/q/1419623/6309>哪个分支包含该提交。

git branch --contains <commit>






在下面通过 user3356885 ,用于获取的分支(远程名称空间中的分支)


As commented below by user3356885, for the fetched branches (branches in remotes namespace)

git branch -a --contains tags/<tag>
git branch -a --contains <commit>

这篇关于Git:如何找出标签在哪个分支上?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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