Sync a forked repository


I have a couple of forked git repositories. When I want to add custom code it’s useful to get the latest available code from the “original” repository. Before I can do that I have to sync my fork with the latest available code.

The steps to do this are explained extensively in the Github help, this is merely a placeholder for my own documentation.

Some online resources

Configuring a remote for a fork

The first step that you will have to take is to add the remote repository as an ‘upstream’ repository.

git remote add upstream

Check that it has been added with

git remote -v

Sync the fork

Once the remote authoritative repository has been added as upstream you’ll have to sync from the upstream code.

git fetch upstream
git checkout master
git merge upstream/master

Once this is done you can update your local repository with Github and you’ll have an updated version.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.