Local git pulls remote new branches

I believe that most of the small partners have encountered such a problem, that is, the xxx branch does not exist locally, but a new branch has been created remotely, and you need to push the code. But you can't switch branches locally without it. At this time, you need to pull this branch down from a distance. The specific operation process is as follows:

premise:

1. View the local branch

git branch

2. View remote branches

git branch -r

 Or view local and remote branches

git branch -a

3. Create a new branch locally and switch to the new branch

git checkout -b 分支名称

4. Bind the local branch with the remote branch

git branch --set-upstream-to= 远程分支名例如(origin/xxx)

5. Whether the test is successful

git pull

If the successful pull is successful, it means that the newly created local branch is associated with the remote 

Guess you like

Origin blog.csdn.net/weixin_51220967/article/details/127886235