# Synchronizing With the Upstream

Just documenting some simple Git basics for myself. Here is how to keep a local repository up to date with an upstream repo.

git remote add upstream https://github.com/webjars/openseadragon.git
git checkout -b upstream upstream/master
git checkout master
git rebase upstream


This pulls changes from the upstream and injects them into the local master, which can then be pushed up to origin on GitHub.

This process works well when all local changes are made on feature / bug fix branches and synchronized to the upstream by pull requests from those branches (pushed up to origin on GitHub). This keeps the upstream branch a clean copy of the upstream and the master branch a clean copy of my fork (which can be pushed to GitHub’s origin).

All new features and/or bug fixes are done on new branches and pushed to the upstream (via a pull request from that branch on origin) or, in the case where the changes are specific to my particular fork, to master.