I'm trying to maintain a set of patches, which needs to be applied to several versions/branches of the code. The current diff/patch method (and git cherry-picking) is not flexible enough, mainly due to the dependency of the context. For example assume my patch adds a few constants in a java class. If in one version of the code another constant was inserted, exactly at the same place, patch will fail. In a general circumstance this is ok, since the order might be important, however in case of java code the order of the fields (at leaast in 99% of the cases) doesn't matter. In another example I wanted to insert one line right after another one. However the context contains in total 6 lines, and the patch is applied normally only if all of those matches.
I tried to manually edit the diff files, to keeping for example only one line of context, but then patch failed with the message "broken patch".
So I would like to know if there is a better (open source preferably) alternative to diff/patch which is more flexible.
Thank you in advance! /Pal
Try to use git format-patch -U1 <revisions>, it produces a patch with 1 line of context.
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