Suppose there's an official repo maintained called O
with branches B1
, B2
& B3
.
One user, who has forked it onto his Github account, made another branch for himself called B4
and is publicly available.
I've also forked the same official repo but I want to fork that user's B4
branch also without affecting my original copy.
I cannot fork the whole official repo again as I've made several custom branches for myself.
So, how can I fork a particular branch onto my Github repo?
You can pull his branch into your local git repo, and then push it up to your GitHub hosted repo.
First, add a remote to this other users's GitHub page
git remote add other-user http://github.com/otheruser/repo
Then make a local checkout of that branch in your repo.
git checkout -b B4 other-user/B4
Finally, push that branch up to your repo hosted on GitHub.
git push origin B4:B4