Update GitHub fork
Let’s say you want to contribute with a new feature to an open source project hosted on GitHub.
You can fork the repo, edit, test, commit your changes, and finally open a pull request.
After some time your local repo might become outdated. How can you update your fork by getting the most recent version from the main repo?
-
Add a new
upstream
remote to track the main repo1
$ git remote add upstream git://github.com/octocat/Spoon-Knife.git
-
Fetch upstream in your local repo
1
$ git fetch upstream
-
Merge
upstream/master
in your current branch to apply the updates1
$ git merge upstream/master
Resources: