Skip to content

How do I check out a remote Git branch?

Checking out a remote branch is easy with newer versions of Git.  First you will need to perform a “git fetch” to download all the objects and refs from other repositories. You can then use “git checkout” with the branch name to checkout a specific branch. The following code can be used to check out a remote branch.

git fetch
git checkout branch_name

If you have more than one remote branches then you’ll need to supply each command with the remote branch. I’ve provided an example below.

git fetch remote_branch
git checkout remote_branch/branch_name

Published inGit

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *