Let's say you've forked a repository and cloned it to your local machine. Your Favorite Collaborator has added a pull request and had it approved by the repository maintainer; you'd now like that code in your personal fork. Here's how.
Make sure you've cd
ed into your fork of the repository on your computer.
You need to tell the fork where its original version lives. This is called "setting the upstream":
git remote add upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git
Next, you'll tell your local copy of git
to grab the latest version of the original. This does not yet incorporate the code to your local copy. It just downloads it.
git fetch upstream
Finally, tell git
to merge the master
branch of the latest version of the original (which you just downloaded) to your current branch.
git merge upstream/master
(more info here: https://help.github.com/articles/configuring-a-remote-for-a-fork/ and here: https://help.github.com/articles/syncing-a-fork/)