Git/Sync a Fork
From charlesreid1
If you have forked a remote repository using git, and it has fallen behind several commits, you may need to sync your fork.
Here's how to do that.
We'll use the hypothetical Github repos https://github.com/ours/repo for the fork and https://github.com/theirs/repo for the original (forked) repo.
# Start by forking the repo on Github... # Check out the fork git clone https://github.com/ours/repo # Add the original (forked) repo as the "upstream" cd repo/ git remote add upstream https://github.com/theirs/repo # Do some work... # Oh no, we missed a bunch of changes to the upstream repo! # Fetch upstream changes git fetch upstream # Checkout the master branch of the fork # (this assumes the master branch of the original, forked repo is what we want to update from) git checkout master # Merge the changes from upstream/master into your local master branch. git merge upstream/master