Quick Tip: Sync a Fork with the Original via GitHub’s Web UIBy Bruno Skvorc
When you fork someone’s repository on GitHub, you’ll want to update your fork with any changes made to the original. There are various ways to do this. In this quick tip, Bruno describes how to update your fork via the GitHub website. Another option is to update your fork via the command line.
I often find myself having to update my fork of someone else’s repo to include the changes made to the original since the fork. In fact, we use this approach often in SitePoint’s Peer Review System as well.
More from this author
Purely by accident, I’ve recently discovered a way to quickly and easily sync a fork with the original repo through the GitHub web UI, so no need to go commando (use the command line).
Note that the approach below does a merge commit, not a proper rebase. If you understand what this means, this is something that will matter to you. In a nutshell, the history looks different than when syncing via the command line as per Github docs. No real effect, but just a heads up!
Here’s a step by step guide, as applied to my out-of-date fork of Gatekeeper:
Step 1: New PR
Go to your own fork’s UI, and click the “New Pull Request” button:
This will take you to a screen not too different from this one:
Step 2: Base Switch
If the option to try “switching the base” is there, click that.
If the option isn’t there, switch the bases manually by using the provided dropdowns, and set them up so that your fork is on the left, and the original is on the right, like so:
Step 3: Send and Merge
Click the green “Create Pull Request” button. In the input fields that appear, give it a title like “Syncing from original”. Optionally, add a description.
Again, click the “Create Pull Request” button to actually send the PR. The result should be a typical PR screen:
Feel free to merge it with the “Merge Pull Request” button (and “Confirm Merge” afterwards), and you’re done!
That’s it – your fork is now in-sync with the changes made to the original, and you can start working on it without fear of conflicts.