Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

5
  • as far as a procedure to combine patches could go : you could generate a file, which has line numbers and context lines matching the ones expected in your patches, apply the patches to said file, and get the final diff. Commented Feb 21, 2023 at 7:04
  • for this to work seemlessly, you need to have exactly compatible patches: on all the lines affected by patch 1 .. n, patch n+1 should have a context which match exactly those lines (line number and line content). Commented Feb 21, 2023 at 7:07
  • to create the initial file, you should scan all the patches, to see what lines the starting file should have. e.g: taking your simple example, you have to read both patches to discover that the starting file needs to have at least 9 lines -- or is it 10 ? -- so that patch 2 applies. Commented Feb 21, 2023 at 7:09
  • @LeGEC thanks for the suggestion! I have tried to do something like that and the issue is that when getting the final diff the number of blank lines causes an issue, at least in my tests. So I am looking for a way to directly combine the patches, without re-diffing. Commented Feb 21, 2023 at 15:06
  • 1
    why not using what you have from git now? applying the 2 patches one after another and than making a new patch from the 2? Commented Mar 2, 2023 at 10:53