cancel
Showing results for 
Search instead for 
Did you mean: 

How can I update forked repository on GitHub?

Hi

I forked a project, applied several fixes and created a pull request which was accepted. A few days later, another change was made by another contributor. So my fork doesn't contain that change.

How can I get that change into my fork? Do I need to delete and re-create my fork when I have further changes to contribute? Or is there an update button?

1 REPLY 1

The "tabula rasa" method.

  1. Keep around the SHA of the "one commit" (or two, three, ...) which are your code and you'd like to submit to the original repo: go to your branch, do a git log and find it / keep it copied somewhere.

  2. find the git url for the original upstream codebase; the one you forked from, not your github clone. say it's git://git.github.com/foo/bar

  3. git remote add upstream git://git.github.com/foo/bar

  4. git fetch

  5. git checkout master

  6. git reset --hard upstream/master (this makes local "master" be same as upstream's master)

  7. git checkout -b your-snazzy-branch-name

  8. git cherry-pick SHA_OF_YOUR_COMMITS

  9. git push origin your-snazzy-branch-name

  10. open a pull request for your-snazzy-branch-name