gpt4 book ai didi

git - 如何列出 Git 1.7+ 中的所有远程分支?

转载 作者:IT王子 更新时间:2023-10-29 01:09:42 27 4
gpt4 key购买 nike

我试过 git branch -r,但它只列出了我在本地跟踪的远程分支。我如何找到那些我没有的列表? (命令列出所有远程分支还是只列出未跟踪的分支对我来说并不重要。)

最佳答案

对于绝大多数[1]的访问者,the correct and simplest answer to the question “如何列出 Git 1.7+ 中的所有远程分支?”是:

git branch -r

对于少数[1] git branch -r 不起作用。如果 git branch -r 不起作用,请尝试:

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

如果 git branch -r 不工作,那么可能是 Cascabel"you've modified the default refspec, so that git fetch and git remote update don't fetch all the remote's branches" .


[1] 在 2018 年 2 月撰写此脚注时,我查看了评论,发现 git branch -r 适用于绝大多数(大约 90% 或 125 来自 140 )。

如果 git branch -r 不起作用,请检查 git config --get remote.origin.fetch 是否包含通配符 (*)根据 this answer

关于git - 如何列出 Git 1.7+ 中的所有远程分支?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3471827/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com