How do I check out a remote Git branch?

后端 未结 30 1863
灰色年华
灰色年华 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:18

    I tried the above solution, but it didn't work. Try this, it works:

    git fetch origin 'remote_branch':'local_branch_name'
    

    This will fetch the remote branch and create a new local branch (if not exists already) with name local_branch_name and track the remote one in it.

提交回复
热议问题