Github: Import upstream branch into fork

I have a fork (origin) from a project (upstream) on github. Now the upstream project has added a new branch, I want to import into my fork. How do I do that?

I tried checking out the remote and creating a branch on top of that, but that configures the branch the way that git push is trying to push to the upstream:

git checkout upstream/branch
git checkout -b branch

edit

Maybe that wasn’t clear, but I want to add the branch to my local repository, so I can push it to origin (my fork) via git push. Because upstream repositories are usually read-only and you fork it to contribute.

So I basically want to checkout a non-existent branch on origin whose contents will be pulled in from upstream.

6 Answers
6

Leave a Comment