/ git

Keeping Your GitHub Fork Up-to-Date

A long-standing issue with GitHub is that after forking a repository, there's not an easy way to keep it updated with changes on the upstream repository. This isn't an issue if you fork and submit a pull request immediately, but if it takes some time, or if you want to re-use the same fork later, you'll probably want it to be up-to-date.

For opaque reasons, this isn't available on the GitHub website, although apparently it used to be a long time ago. Odd, considering that the ease of forking and submitting pull requests seems like one of the major features of GitHub.

Regardless, this is pretty painless do to manually on the command-line. First, you'll need to add a 2nd remote to the repository. By default, git uses an "origin" remote:

git remote add upstream <URL>
git remote -v

This only has to be done once to the local repository. Then fetch and merge changes from upstream:

git fetch upstream
git checkout master
git merge upstream/master

This merges all upstream changes into your fork. If you want to push that back to GitHub:

git push

All done!

This is documented in more detail on Configuring a Remote for a Fork and Syncing a Fork.