git fetch origin不会获取所有分支 [英] git fetch origin doesn't fetch all branches
问题描述
我读了此问题的答案,即 git获取原点
应该获取所有个原点分支。就我而言,它似乎并没有给我任何分支。这是我所做的:
I read in the answers to this question that git fetch origin
should fetch all branches of origin. In my case, it doesn't seem to give me any branches, though. Here's what I did:
最初,一个称为origin的远程站点有7个分支。我克隆了。 git分支
然后仅返回 master
。我确实做了 git fetch origin
,而 git branch
仍然只显示 master
。如何获得其他6个分支而不单独获取它们?
Initially, a remote called origin had 7 branches. I cloned it. git branch
then returned only master
. I did git fetch origin
, and git branch
still only shows master
. How can I get the other 6 branches without fetching them individually?
推荐答案
您拥有全部7个分支,但 git branch
仅显示本地分支。即使您现在在系统上本地拥有分支机构数据,它们仍被视为远程分支机构。 您可以通过 git branch -a
看到它们。它们的名称类似于 remotes / origin / branchname
。您可以通过指定以下全名来检出它们: git checkout remotes / origin / branchname
。
You have all 7 branches, but git branch
only shows local branches. Even though you now have the branch data locally on your system, they are still considered "remote branches". You can see them with git branch -a
. They'll be called something like remotes/origin/branchname
. You can check them out by specifying this full name: git checkout remotes/origin/branchname
.
此外,您克隆存储库时,已经获得了所有这些分支。运行 git fetch origin
只会使用自上次获取(或克隆)以来原始发生的任何新内容更新存储库。
Also, you already got all of these branches when you cloned the repository. Running git fetch origin
will simply update your repository with anything new that happened on origin since you last fetched (or cloned).
您可以在git文档中了解有关远程分支的更多信息: Git分支-远程分支
You can read more about remote branches in the git documentation: Git Branching - Remote Branches
这篇关于git fetch origin不会获取所有分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!