Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to edit a diff/patch file cleanly ? Are there any patch file editors?

Scenario: I have a patch file that applies cleanly to my working files, but I do not want all the changes from the patch.

Usually, I do vim example.patch, remove unwanted changes and them apply patch -p0 -i example.patch but at times the patch does not apply cleanly, and I have to start over again.

Is there a patch file editor that allows users to edit and delete part of the patch and still can apply cleanly ?

like image 501
My_patch_question Avatar asked Sep 20 '11 13:09

My_patch_question


People also ask

Can you edit a patch file?

If you open a diff file in emacs and put the editor in "diff" mode you can actually edit patches and it will update the hunk markers in a smart way.

How do I merge patch files?

Make a new branch starting from the revision just before the first changeset. In the new branch, merge each changeset of the issue, in order. Take a diff between the start of the new branch and the final result. (If you do issue-based branching, you'd get the above situation automatically).


1 Answers

If you open a diff file in emacs and put the editor in "diff" mode you can actually edit patches and it will update the hunk markers in a smart way. Works really well for me!

like image 90
jkp Avatar answered Sep 28 '22 07:09

jkp