How do I check out a remote Git branch?

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

    The git remote show command will list all branches (including un-tracked branches). Then you can find the remote branch name that you need to fetch.

    Example:

    $ git remote show origin
    

    Use these steps to fetch remote branches:

    git fetch  :
    git checkout  (local branch name should the name that you given fetching)
    

    Example:

    $ git fetch origin test:test
    $ git checkout test
    

提交回复
热议问题