Selectively importing other people's pull requests in your own Github fork
Given a generic open source project on Github that I have forked, is there any way I can find a pull request, submitted to the original branch, and choose to "import" it in my own fork (given that the files should be diff-compatible) so that it will be applied to my branch?
Yes. Here's how I would do it:
- Fork the repository to myaccount/project
- Clone myaccount/project locally
- Use
git remote add [remote name]
for each of the remotes that have fixes you want to use. - Run
git fetch --all
to download everything - Use
git merge --no-ff -m [remote-name]/[branch-name]
to merge in the changes from each Pull Request that you want to include in your fork.--no-ff
creates a merge commit for audit-ability and-m
let's you specify the message in your editor (so you can include a link to the Pull Request in your merge commit). - Once you've made the merge, you can use
git push
to update your fork on GitHub with the various Pull Requests that you've merged in.