How do I check out a remote Git branch?

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

    In this case, you probably want to create a local test branch which is tracking the remote test branch:

    $ git branch test origin/test
    

    In earlier versions of git, you needed an explicit --track option, but that is the default now when you are branching off a remote branch.

提交回复
热议问题