How do I fetch a branch on someone else's fork on GitHub? [duplicate]
Solution 1:
$ git remote add theirusername [email protected]:theirusername/reponame.git
$ git fetch theirusername
$ git checkout -b mynamefortheirbranch theirusername/theirbranch
Note that there are multiple "correct" URIs you can use for the remote when you add it in the first step.
-
[email protected]:theirusername/reponame.git
is an SSH-based URI -
https://github.com/theirusername/reponame.git
is an HTTP URI
Which one you prefer to use will depend on your situation. GitHub has a help article explaining the difference and helping you choose: Which remote URL should I use?
Solution 2:
amalloy's suggestion didn't work for me. This did:
git remote add theirusername https://github.com/theirusername/reponame
git fetch theirusername
git checkout -b mynamefortheirbranch theirusername/theirbranch
Resources:
- https://git-scm.com/book/ch2-5.html
- http://crunchify.com/how-to-fork-github-repository-create-pull-request-and-merge/