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
upstreamremote to track the main repo
$ git remote add upstream git://github.com/octocat/Spoon-Knife.git
Fetch upstream in your local repo
$ git fetch upstream
upstream/masterin your current branch to apply the updates
$ git merge upstream/master