How do I check out a remote Git branch?

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

    git branch -r says the object name is invalid, because that branch name isn't in Git's local branch list. Update your local branch list from origin with:

    git remote update
    

    And then try checking out your remote branch again.

    This worked for me.

    I believe git fetch pulls in all remote branches, which is not what the original poster wanted.

提交回复
热议问题