gpt4 book ai didi

git fetch 不获取远程分支 - 如何获取所有远程分支

转载 作者:行者123 更新时间:2023-12-03 08:58:21 29 4
gpt4 key购买 nike

git fetch 获取远程分支的原因是什么?

How do I check out a remote Git branch?

我所做的就是运行 git fetch - 然后我就看到了

C:\site\blog>git fetch *master

我希望看到类似的内容:

C:\site\blog>git fetch *master origin/branch1 origin/branch2

git fetch doesn't fetch all branches

我在接受的答案中运行命令

git config --get remote.origin.fetch

命令的输出是

+refs/heads/*:refs/remotes/origin/*

据我了解,这表明我不仅跟踪主机,还跟踪所有 Remote 。

怎么了?我该如何解决?无法 git fetch 的原因是什么?为什么会坏掉?

运行 git fetch -a 也不会执行任何操作。

运行 gitbranch -avv 给出以下内容:

enter image description here

那么为什么git fetch不起作用?

最佳答案

Track all remote git branches as local branches

for i in `git branch -a | grep remote | grep -v HEAD | grep -v master`; do git branch --track ${i#remotes/origin/} $i; done

这是错误的术语。它将远程分支作为本地分支进行跟踪。

关于git fetch 不获取远程分支 - 如何获取所有远程分支,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53216223/

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