Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Sync master branch of forked repo with upstream master branch
# Part 1, if necessary:
# Configure a remote for your fork
# https://help.github.com/articles/configuring-a-remote-for-a-fork/
# In Terminal, cd into your local repo and run this command:
git remote add upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git
# In general, git remote add upstream <upstream repo>
# Verify by running this command:
git remote -v
# Part 2:
# Sync your fork with upstream repo
# https://help.github.com/articles/syncing-a-fork/
git fetch upstream
git checkout master
git merge upstream/master
# Part 3:
# Push changes from your local repo to remote
# https://help.github.com/articles/pushing-to-a-remote/
git push origin master
# In general, git push <REMOTENAME> <BRANCHNAME>
# Here, 'origin' is your fork's repo on GitHub.
# Done. The master branch of your forked repo,
# both locally and remotely,
# is now even with the upstream master branch.
@jeremykohn

This comment has been minimized.

Copy link
Owner Author

@jeremykohn jeremykohn commented Jun 23, 2017

Also see https://gist.github.com/xaxim/0ad48b3afe6e81fa6097d82b22ed8cde

git fetch upstream
git checkout master
git merge upstream/master
git merge upstream/master
git commit
git push
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment