Applying GitHub fork commits when the fork queue hates you
The GitHub fork queue rarely works like you’d like it to. If your project has a fork with commits that you’d like to apply, then about 80% of the time, the fork queue tells you that the changes will not apply cleanly. This means you’re stuck doing it yourself.
Here’s a way that saves the commit history so your contributors still get credit.
1) Grab the fork and stick it into your own project under a new branch.
git fetch THE-FORK-REPO-URL master:NEW-BRANCH-NAME
I usually just use “testing” or something like that for my branch name.
2) Make sure you’re currently on the “master” branch.
git checkout master
3) Merge the changes into master.
git merge NEW-BRANCH-NAME
4) You’ll no doubt have some conflicts, so read the output to see which files have conflicts, then open those up in your favorite text editor and remove the old stuff, leaving the new stuff (you’ll see markers telling you what’s old and what’s new).
5) Add the files and commit them, then push the changes.
git add .
git commit -m "merging from totally awesome contributor"
git push origin master
6) If you get git push rejected non-fast-forward errors, you’ll have to pull the current master:
git pull origin master
Then fix any conflicts, then you should be free to run your git push origin master again.