How to download a branch with git?

I have a project hosted on GitHub. I created a branch on one computer, then pushed my changes to GitHub with:

git push origin branch-name

Now I am on a different computer, and I want to download that branch. So I tried:

git pull origin branch-name

…but all this did was overwrite my master branch with the changes in my new branch.

What do I need to do to properly pull my remote branch, without overwriting existing branches?

11 Answers
11

Leave a Comment