转自: https://stackoverflow.com/questions/67699/how-do-i-clone-all-remote-branches
First, clone a remote Git repository and cd into it:
Next, look at the local branches in your repository:
But there are other branches hiding in your repository! See these using the -a
flag:
To take a quick peek at an upstream branch, check it out directly:
To work on that branch, create a local tracking branch, which is done automatically by:
Here, "new branch" simply means that the branch is taken from the index and created locally for you. As the previous line tells you, the branch is being set up to track the remote branch, which usually means the origin/branch_name branch.
Your local branches should now show:
You can track more than one remote repository using git remote
:
At this point, things are getting pretty crazy, so run gitk
to see what's going on: