How to sync a GitHub fork

I recently needed to sync a GitHub repo I forked to the latest status of the original fork. This is easy to do, but you have to know which buttons to push.

To start, open the forked repo in Github. You should see a mention that this branch is behind the original branch. Next to that mention, there is an option to open a pull request.

Start by clicking the pull request button.

From there, GitHub by default takes you to a view of opening a PR on the original repo to merge in your changes. This is not what you want, you want the inverse. You can achieve this, by hitting the “switching the base” option:

Once you switch the bases, you’ll be able to open a pull request to merge in the changes from the original branch into your own. You can merge those in by creating a pull request:

After comparing the branches, create a pull request.

Provide the pull request with a title and a body, and then create the pull request:

Create a pull request.

Finally, on the pull request that got created, scroll to the bottom and merge the pull request:

Merge the pull request.

And that’s it. Now your fork is up to date with the original repo.

Summary

This was a quick walkthrough on how you can update a fork and sync it to the latest state of the original repository.

Leave a Reply