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 . Doing git status shows nothing too.

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?


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

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. When you use --all you see all the tracking branches in origin/

Related:
- How to clone all remote branches in Git?
- How do you create a remote Git branch?
- Git fetch remote branch
- How do I check out a remote Git branch?


Do this list of commands:

git branch -a :

you will see the list of remote branches

git remote show origin

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

which updates the entire list of remote branches tracked by your local repository and then run

git fetch

which updates all tracked branches.

Then you can create your branch with the following checkout command:

git checkout -b your_branch_local_name origin/your_branch_remote_name

链接地址: http://www.djcxy.com/p/3844.html

上一篇: 如何在不合并的情况下下载新的远程分支?

下一篇: GIT提取或克隆存储库仅获取Master分支