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
- Browse to your forked repository on Github.
- Click the “Pull request” link on the right of “This branch is N commits behind”
- 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.
- 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.
- 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.