Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I just forked a project in Github. I made modifications and send pull request. Th owner merge my fork with the main project and after that he made some modifications. So for now my fork is not updated with the main project. I miss the modifications he made after merging my pull request. How can update my fork with the Main project? Is there a way to do that in the web interface?

Thanks

share|improve this question
    
I write a simple instruction. check out at here: webapps.stackexchange.com/a/58140/63016 –  Youngjae Mar 12 at 5:28
    
There's now an official doc which is well done: help.github.com/articles/syncing-a-fork –  Andre Miras Apr 4 at 13:06
add comment

2 Answers 2

up vote 11 down vote accepted

By design, forking a project creates a separate repo that is not updated when the original repo changes. However, git makes it pretty easy to update manually.

You need the help of a 3rd repository (your local copy suffices). There are 3 repos:

  • "Upstream": The upstream project's repository on Github.
  • "Origin": Your fork's repository on Github
  • "Local": Your local repository on your computer. I will assume you created it by cloning Fork using git clone git@github.com:your-username/projectname.git, and that everyone is using branch master.

Assuming currently "Origin" and "Local" are in the same state, and "Upstream" is ahead by 1 or more commits (the merge and any subsequent changes).

First add the upstream project as a Git remote:

git remote add upstream https://github.com/upstream-username/projectname.git

Then pull (meaning fetch and then merge automatically) the changes from the remote's master branch into your local repository's current (master) branch:

git pull upstream master

Now your local repository is in sync with upstream. Finally, push your local repo to your Github fork:

git push origin master

Now everything is in sync.

share|improve this answer
1  
Thanks a lot.. it's a shame that this may not be possible to make that in the web interface.. –  bAN Aug 1 '12 at 9:44
1  
This is indeed possible on the web interface: webapps.stackexchange.com/a/31010/10390 –  thSoft Jan 30 '13 at 10:22
add comment

You need to add a remote (see GitHub help) and pull from that new remote.

git remote add mainProject https://github.com/user/mainProject
git pull mainProject master
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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