简体   繁体   English

GIT提取或克隆存储库只能获得Master分支

[英]GIT pulling or cloning repository only gets Master branch

I host on BitBucket when I git clone a repository or use git pull origin master and git pull origin myBranch it does pull second time, but when I list branches with git branch -v I only see master . 当我git clone一个存储库或使用git pull origin mastergit pull origin myBranch它确实第二次拉动时,我主持BitBucket,但是当我用git branch -v列出分支时我只看到master Doing git status shows nothing too. git status也没什么。

How do I pull all of the branches off the web repo to my local repo? 如何将网络仓库中的所有分支机构拉到我的本地仓库?

Could it be that it's because I changed computers and name on the git settings changed so it only lets me get master since it's the default branch and the other one can be only accessed by whoever created it? 可能是因为我更改了计算机并更改了git设置上的名称,所以它只能让我获得master因为它是默认分支而另一个只能由创建它的人访问?

Try using this: 试试这个:

git branch -a

You'll see the list of remote branches in origin/ eg 您将看到原始/例如远程分支的列表

Output: 输出:

remotes/origin/tk_removes_call_centers
remotes/origin/tk_warm_transfer_fix
remotes/origin/update_README

and you can then 然后你就可以了

git checkout [any_individual_branch_name]

You can also get the same list with git branch -v --all which includes the most recent commit info, ie 您还可以使用git branch -v --all获取相同的列表,其中包括最新的提交信息,即

git branch -v --all

output: 输出:

remotes/origin/tk_removes_call_centers     1478b14 re-adding call feedback workers
remotes/origin/tk_warm_transfer_fix        94720c5 handling blank auto policy
remotes/origin/update_README               a769b82 Update README

git branch -v (without --all ) only shows branches you've worked on. git branch -v (不带--all )只显示你工作过的分支。 When you use --all you see all the tracking branches in origin/ 当您使用--all您会看到所有跟踪分支的origin/

Related: 有关:
- How to clone all remote branches in Git? - 如何在Git中克隆所有远程分支?
- How do you create a remote Git branch? - 你如何创建一个远程Git分支?
- Git fetch remote branch - Git fetch远程分支
- How do I check out a remote Git branch? - 如何查看远程Git分支?

Do this list of commands: 执行以下命令列表:

git branch -a : git branch -a

you will see the list of remote branches 您将看到远程分支列表

git remote show origin git远程显示来源

It will display all branches known by your local repository. 它将显示本地存储库已知的所有分支。 If the branch you want to use is not in the list, run the command 如果要使用的分支不在列表中,请运行该命令

git remote update git远程更新

which updates the entire list of remote branches tracked by your local repository and then run 它会更新本地存储库跟踪的整个远程分支列表,然后运行

git fetch git fetch

which updates all tracked branches. 它会更新所有被跟踪的分支。

Then you can create your branch with the following checkout command: 然后,您可以使用以下checkout命令创建分支:

git checkout -b your_branch_local_name origin/your_branch_remote_name git checkout -b your_branch_local_name origin / your_branch_remote_name

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM