Ok I haven't find a better way to title my question. Explaining the scenario is easier. But remember this is a Github question, not a Prototype-JS question (please don't add the tag for me)
I'm working on a Prototype-based web application. I found that 1.7.1 (no blame to the author) has a few bugs that are annoying for us. All these bugs do have, fortunately for us, a publicly available fix through a pull request that has been accepted into the master branch.
My boss and I discussed about the choice between patching Prototype 1.7.1 for each incompatibility we find and we agreed that using the "development" version in a soon-to-be production application is not the best choice, so our idea is to patch our version of Prototype.
I am responsible for this. Since I want to track the changes my company applies to Prototype (even if I'm the only who'll touch the JS file), I want to do it in an efficient way that can be left to posterity.
Github allows you to fork any project into your own workspace so you can play with it as much as you wish. I would like to keep track of the patches I import into Prototype by actually linking them to existing pull requests made to the original project.
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?
Of course, this allows me, over time, to keep track record (with comments and discussions) about what PRs I chose to import in my branch and which I didn't.
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:
git remote add [remote name]
for each of the remotes that have fixes you want to use.git fetch --all
to download everythinggit 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).git push
to update your fork on GitHub with the various Pull Requests that you've merged in.My workflow for selectively adding pull requests is as follows:
First make a fork.
Then clone the fork locally.
Apply patches from Pull Request's.
https://github.com/mafintosh/peerflix/pull/188
https://github.com/mafintosh/peerflix/pull/188.patch
.
adding .patch
to the url creates a patch file on
GitHub.
So the workflow becomes like :
$ wget https://github.com/mafintosh/peerflix/pull/188.patch
$ git am 188.patch
If you want to test it on a branch before applying to the master
then the same rules apply to it as applying any other patch.
1. Create a Branch.
2. Apply the patch
3. Test the Patch.
4. Merge to master.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With