Skip to content

Instantly share code, notes, and snippets.

@pm-hwks
Created January 22, 2019 03:03
Show Gist options
  • Save pm-hwks/a380c38097c45cd30cc7d7d5b50c0296 to your computer and use it in GitHub Desktop.
Save pm-hwks/a380c38097c45cd30cc7d7d5b50c0296 to your computer and use it in GitHub Desktop.
[Git syncing a fork] How to sync a forked repo #git #github
## Reference
# https://help.github.com/articles/syncing-a-fork/
git remote -v
# Add original git remote repo
git remote add upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git
git remote -v
# Fetch the branches and their respective commits from the upstream repository. Commits to master will be stored in a local branch, upstream/master.
git fetch upstream
# Check out your fork's local master branch.
git checkout master
#Merge the changes from upstream/master into your local master branch. This brings your fork's master branch into sync with the upstream repository, without losing your local changes.
git merge upstream/master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment