Last Updated: February 25, 2016
·
11.11K
· hobnob

Pull a Remote Branch into a New Branch

First fetch the contents of the remote repository, like so:

git fetch remote_name

You can then check out a remote branch in Git using the following command:

git checkout -b new_branch remote_name/new_branch

Where new_branch is the name of the branch you want, and remote_name is the name of the remote you are pulling from (origin if it is the same as the rest of your repository)

For example, if I had a branch called someBranchName the command would be:

git checkout -b someBranchName origin/someBranchName