如何在Git 1.7+中列出所有远程分支? [英] How do I list all remote branches in Git 1.7+?

查看:129
本文介绍了如何在Git 1.7+中列出所有远程分支?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试过 git branch -r ,但那只列出了我在本地跟踪的远程分支。我如何找到那些我没有的清单? (这个命令是否列出了所有的远程分支或只有那些未被跟踪的分支并不重要。)

解决方案 div>

对于绝大多数 [1] 的访问者来说,

  git分支-r 
[1] git分支-r 不起作用。如果 git branch -r 不起作用,请尝试:

  git ls-远程 - 头<远程名称> 

如果 git branch -r 不起作用,那么也许就像 Cascabel 所说你修改了默认的refspec,所以 git fetch git remote update 不要获取所有远程的分支机构






[1] 在撰写2018年2月脚注时,我看了一下评论, git branch -r 适用于绝大多数(约90%或 125 out of 140 )。


I've tried git branch -r, but that only lists remote branches that I've tracked locally. How do I find the list of those that I haven't? (It doesn't matter to me whether the command lists all remote branches or only those that are untracked.)

解决方案

For the vast majority[1] of visitors here, the correct and simplest answer to the question "How do I list all remote branches in Git 1.7+?" is:

git branch -r

For a small minority[1] git branch -r does not work. If git branch -r does not work try:

git ls-remote --heads <remote-name>

If git branch -r does not work, then maybe as Cascabel says "you've modified the default refspec, so that git fetch and git remote update don't fetch all the remote's branches".


[1] As of the writing of this footnote 2018-Feb, I looked at the comments and see that the git branch -r works for the vast majority (about 90% or 125 out of 140).

这篇关于如何在Git 1.7+中列出所有远程分支?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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