GitHub makes it very simple to fork — or create a personal copy of — a public repository. While I could easily star a repository I found interesting (or watch it), I tend to fork instead, thinking, somewhat optimistically, that I’m going to dig in and immediately start contributing.
As the saying goes, “l’enfer est plein de bonnes volontés”.
Updating a fork via the command-line is as easy as running
git pull (provided your remote origin url is set correctly). On GitHub.com, it requires a few additional steps:
- Log into GitHub and click on the repository you’d like to update. If your fork isn’t current you’ll see a message like this: This branch is 630 commits behind [repository name]:master. And yes, one of my forks was actually over 600 commits behind the master branch.
- Click the green New Pull Request button.
- “There isn’t anything to compare,” GitHub will sniff, more than a little disappointed in your lack of commitment to open source software. This will come as no surprise, as the base fork is set to the master branch and the head fork — where all the changes should be — is your local fork. Find and click the “switching the base” link to reverse them.
- “This comparison is big! We’re only showing the most recent 250 commits.” That’ll do, GitHub. Click the green Create Pull Request button.
- Enter a title (e.g. “update to current branch”) then click the Create Pull Request button. Review the message at the top to make sure you’re pulling the right way. It should read something like this:
[username] wants to merge 630 commits into [username]:master from [repository name]:master
- If so, scroll down past the hundreds of commits made by more dedicated developers than yourself, to the green Merge Pull Request button and click it quickly before the guilt and self-loathing sets in.
- GitHub will give you one last opportunity to change your merge message. Click the button (that now reads Commit Merge). Your fork is now current to the master branch!
Now get busy.