Knowledge for the World
How to check out a remote branch in git

How to check out a remote branch in git

  • by Tyler (218)
  • Time to complete: 1 minute

If you're working on your development environment but you need access to a branch that someone else has pushed to "origin" then you'll need to follow these steps.

1

You must fetch origin to get all of the remote branches that are available. To fetch origin simply move to your working directory and type: git fetch origin

2

The easiest way to get the remote branch is by checking it out. To do so simply type: git checkout -b branch_name origin/branch_name This will checkout the remote branch called branch_name into a local branch with the same name.