Paul Murphy
Paul Murphy

Reputation: 675

How to get a new branch in my fork from the original repository?

I forked a repo and the original repo has gotten a new branch after I forked it.

OriginalRepo
   |
   +-BranchA
   |
   +-newBranch


MyFork
   |
   +-BranchA

I want to get the branch newBranch into my fork, how can I do this?

Upvotes: 47

Views: 28364

Answers (2)

Ilya V. Schurov
Ilya V. Schurov

Reputation: 8087

It is also possible to do with Github UI. You can go to the branches of your repo (i.e. in a branch selector, pick View all branches, you will be taken to https://github.com/<username>/<repo>/branches), then click New Branch, select upstream repository from the drop-down list and then a branch from another drop-down list.

Screenshot of Github UI

Upvotes: 9

levi
levi

Reputation: 22697

git remote add OriginalRepo repository-URL
git fetch OriginalRepo
git checkout newBranch
git push origin newBranch

Upvotes: 79

Related Questions