How to Checkout a Remote Git Branch (Short Answer)


You Have One Remote
1
2
$ git fetch
$ git checkout <remote-branch-name>

The above commands will:

  • Fetch all remote branches
  • Checkout to a branch
You Have More Than One Remote
1
2
$ git fetch <remote-name>
$ git checkout -b <remote-branch-name> <remote-name>/<remote-branch-name>

The above commands will:

  • Fetch all remote branches
  • Create your own copy of that branch and checkout to the branch




Related Posts

What is the Difference Between Git Pull and Git Fetch (Short Answer)

Short answers to the question what is the difference between...

How to Revert a Git Repository to a Previous Commit (Short Answer)

Short answers to the question how to revert a git...

How to Modify Existing Unpushed Commit Messages (Short Answer)

Short answers to the question how to modify existing unpushed...

How to Undo a Git Add Before Commit (Short Answer)

Short answers to the question how to undo a git...

How to Rename a Local Git Branch (Short Answer)

Short answers to the question how to rename a local...

How to Delete a Git Branch Locally and Remotely (Short Answer)

Short answers to the question how to delete a git...