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

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

问题描述

我现在忙于很多分支机构的项目,而且我在最后一个分支上完成了一个标签。但是我不清楚在哪个分支上这个标签。



如何找出哪个分支标记是? 甚至更短:

  git branch --contains tags /< tag> 

(适用于任何tree-ish参考)




如果您可以找到标签引用
$ b $

  git rev-parse --verify tags /< tag> ^ {commit} 
#或更短:
git rev-parse tags /< tag>〜0

然后你可以找到<

  git branch --contains< commit> 






由于评论 user3356885 ,用于获取的分支(在远程名称空间中的分支)

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


I'm currently busy with 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.

How to find out on which branch tag is?

解决方案

Even shorter:

git branch --contains tags/<tag>

(it works for any tree-ish reference)


If you can find which commit a tag refers to:

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

Then you can find which branch contain that commit.

git branch --contains <commit>


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天全站免登陆