How do I check out a remote Git branch?

后端 未结 30 1986
灰色年华
灰色年华 2020-11-22 00:12

Somebody pushed a branch called test with git push origin test to a shared repository. I can see the branch with git branch -r.

<
30条回答
  •  礼貌的吻别
    2020-11-22 00:27

    First, you need to do:

    git fetch # If you don't know about branch name

    git fetch origin branch_name
    

    Second, you can check out remote branch into your local by:

    git checkout -b branch_name origin/branch_name
    

    -b will create new branch in specified name from your selected remote branch.

提交回复
热议问题