Skip to content

Instantly share code, notes, and snippets.

@gcamp806
Last active September 8, 2017 19:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gcamp806/3a8bc9001bd2b08df5a7ee9f2219f4d2 to your computer and use it in GitHub Desktop.
Save gcamp806/3a8bc9001bd2b08df5a7ee9f2219f4d2 to your computer and use it in GitHub Desktop.
Keep your forked repo up-to-date

How to sync a forked repo with the upstream repo

After forking a repo, often you will want to keep it in sync with the upstream master repo. Here are the steps you can follow to accomplish that.

1. Clone your fork

git clone git@github.com:YOUR_USERNAME/REPO_NAME.git

2. Add a remote from the upstream (original) repo in your local forked repo

cd REPO_NAME
git remote add upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPO_NAME.git
git fetch upstream

3. Update your fork from the original repo to merge in their changes (replace master with proper branch name, if necessary)

git pull upstream master

4. Push your changes back to your github repo (again, replace master with proper branch name, if necessary)

git push origin master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment