I have forked a repo into my own github account and have successfully pulled it to my PC, however there is now a new branch on the original repo that I want as well but when I try to fork that branch, it takesme to the master branch on my github account without actually doing anything. How do I get both branches on my account.
Once you have cloned your fork, you can on your local cloned repo add a new remote referencing the original repo (the one you have forked, and the one where a new branch of interest just appeared)
It is the triangular workflow:
What you do is:
cd /path/to/local/repo
git remote add upstream /url/of/original/repo
git fetch upstream
That last fetch will include the new branch (in the remotes/upstream
namespace)
From there, you can easily create a local branch starting from that upstream/newBranch
and push it to your fork (referenced by the remote named 'origin
')
git checkout -b newBranch upstream/newBranch
git push -u origin newBranch
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With