Updating a forked repository to the original repository.

Simple guide to updating the forked repository to the original one.

September 29, 2019

Code 💻

1 min read

1. Add remote with the original repository url - name it "upstream"

git remote add upstream https://github.com/original-repo/example.git

2. Fetch all the branches and content of remote upstream

git fetch upstream

3. Need to rewrite the master with upstream's master using git rebase

- Also need to make sure that you are on the master branch: git checkout master

git rebase upstream/master

4. Push the updates to local master (may need --force)

git push origin master

Also, some great content about How to GitHub: Fork, Branch, Track, Squash and Pull Request