193

I have created a fork from a project on GitHub. How can I now pull changes from the project that I forked from?

3
  • 7
    The title is different from the question. It should be Pull from other remote
    – Daniel B
    Sep 18, 2018 at 4:57
  • 2
    Could you please edit the title? I came here from this search: google.com.au/…. To pull from another branch do this: `git pull origin branch_name_you_want_to_pull_from:branch_name_to_pull_to
    – James Ray
    Oct 23, 2019 at 5:45
  • Moved this Q&A to stackoverflow.com/questions/58516415/….
    – James Ray
    Oct 23, 2019 at 6:12

2 Answers 2

267

git pull is really just a shorthand for git pull <remote> <branchname>, in most cases it's equivalent to git pull origin master. You will need to add another remote and pull explicitly from it. This page describes it in detail:

http://help.github.com/forking/

2
  • Thanks! Should I add the "upstream" to the same project folder as my origin? Eg. cd project git remote add upstream git://github.com/somename/original-project.git
    – Ran
    Feb 13, 2010 at 11:00
  • After such pulling i see merge prompt, but not just clean another branch
    – Yola
    Jul 13, 2018 at 16:46
67

upstream in the github example is just the name they've chosen to refer to that repository. You may choose any that you like when using git remote add. Depending on what you select for this name, your git pull usage will change. For example, if you use:

git remote add upstream git://github.com/somename/original-project.git

then you would use this to pull changes:

git pull upstream master

But, if you choose origin for the name of the remote repo, your commands would be:

To name the remote repo in your local config: git remote add origin git://github.com/somename/original-project.git

And to pull: git pull origin master

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.