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
Written by David North
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Git
Authors
khasinski
591.1K
dmichaelavila
500.4K
Related Tags
#git
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#