Updating a GitHub Fork
If you want to contribute a new feature to an open-source project hosted on GitHub, you can fork the repository, make your changes, test them, commit them, and finally open a pull request.
Over time, your local repository might become outdated. How can you update your fork with the latest version from the main repository?
-
Add a new
upstream
remote to track the main repository:1
$ git remote add upstream git://github.com/octocat/Spoon-Knife.git
-
Fetch updates from the upstream repository:
1
$ git fetch upstream
-
Merge
upstream/master
into your current branch to apply the updates:1
$ git merge upstream/master
Resources: