I have a remote Git (Github) repo. I cloned it using the git clone
command. but when I try to see the branches Using the git branch
command it only shows one branch, 'main',while there is at least 15+ branches on the remote repo, which are visible via the command git branch -r
. How can I get my all the remote branches into my local repo?
The idea is to not "pollute" your local branch namespace with all the remote tracking branches.
Using git branch -avv
, you will see both local (main) and remote tracking branches ( origin/xxx
).
You can use the "guess mode" of git switch
to create a local branch which will have its corresponding remote branch as upstream.
git switch <branch>
If
<branch>
is not found, but there does exist a tracking branch in exactly one remote (call it<remote>
) with a matching name, treat as equivalent togit switch -c <branch> --track <remote>/<branch>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.