如何列出在特定存储库中包含给定提交的分支? [英] How to list branches that contain a given commit on a specific repository?

查看:109
本文介绍了如何列出在特定存储库中包含给定提交的分支?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我读过 Git:如何找出哪个分支标签?以及其他许多帖子和我已知道如何使用:
git branch --contains tag



然而,我仍然需要知道如何列出在特定存储库中包含给定提交(或标记)的分支
$ b

背景



我使用以下方式从远程存储库 archive 中提取了一列标签:

  git ls-remote --tags archive 

现在,提取标签,我希望得到包含分支的列表。
使用命令:
git branch --contains tag
没有帮助,因为找不到标签,因为它们不存在于 origin repository。

解决方案

您需要 git branch - all - 包含 commit 可以查看其他远程分支。



这取决于你是否提交了提交想要检查它的任何远程位置 - git fetch archive 在您的案例中。



没有它,您的本地存储库没有提交,几乎没有任何工作。例如,如果没有提交,你不能 git log 等等。有各种各样的(半工作)解决方法,例如SSH到服务器并对其进行处理(如果可用)或使用各种Web API(GitHub,Stash)(如果可用),但基本上需要提交的提交。 git ls-remote 是可以在远程存储库上工作而无需在本地任何东西的异常。


So I've read Git: How to find out on which branch tag is? and many other posts and I already know how to use: git branch --contains tag

However, I still need to know how to list branches that contain a given commit (or tag) in specific repository.

Background

I've extracted a list of tags from a remote repository archive using:

git ls-remote --tags archive

Now, for each of the tags extracted, I wish to get the list of containing branches. Using command: git branch --contains tag doesn't help because the tags are not found because they do not exists in origin repository.

解决方案

You need to git branch--all--containscommit to see branches from other remotes.

This still depends on you fetching the commits you want to examine from whatever remote they're on - git fetch archive in your case.

Without it your local repository doesn't have the commits, and pretty much nothing will work. For example, you can't git log etc. without having the commits present. There are all sorts of (semi-working) workarounds, like SSHing to the server and working on it (if it's available) or using all sorts of web APIs (GitHub, Stash) if they're available, but basically you need to the the commits present. git ls-remote is the exception that can work on a remote repository without having anything locally.

这篇关于如何列出在特定存储库中包含给定提交的分支?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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