# Add an upstream remote for the repo that you just forked from
git remote add upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git
# Fetch the branch info
git fetch upstream
# Check out the local branch you'd like to sync up
# Set it to track against the local master so we can push/pull with shorthand
git checkout master --set-upstream=origin/master
# merge in the changes from the upstream repo
# at this point you should fast-forward and be in sync with the remote branch
git merge upstream/master
# push the local sync up to your repo
# since we set this to track origin/master already there is no need to specify
git push
Tag: git
Syncing Forks Without Merge Commits
I was looking for a quick way to sync a forked GitHub repository that had upstream changes without using their interface to create a pull request (doing so would result in a merge commit showing up in the list of commits when I submit another pull request).
Thats when I found Upriver.
Pretty straightforward:
- Give it authorization to use your GitHub account.
- Tell it which branches to sync
- Click Pull
Thanks for the cool tool @bardiharborow