How to Update a Fork from Head in Github

I frequently fork repositories for internal use so that the code we are using does not change. I manually update my fork to match the latest upstream code, and then test the updated code with our system.

I had previously been using git on my local machine to perform this merge and push the updates to my fork on GitHub. I now follow these steps to update my fork with any changes from the upstream/base repository. Thank you to Rick Cogley for posting these steps!

How to Update a Fork in Github

  1. Browse to your forked repository on Github.
  2. Click the “Pull request” link on the right of “This branch is N commits behind”
  3. Click the “switching the base” link to change your fork to the base, and the original to the head fork. Now you should see all of the head commits that need to be pushed to your fork. By default, Github will compare the base fork with your fork, and will show the changes you have made to your fork OR will not find any changes if you made no changes to your fork.
  4. Click the green “Create Pull Request” button, enter a Title for your pull request (e.g. “Merge upstream changes”), then click the green “Create Pull Request” button.
  5. Click the green “Merge pull request” button, then click the green “Confirm Merge” button.

Assuming you had not made changes to your fork, the upstream changes will be merged automatically.

Leave a Reply

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