Edit diff files

I have a .diff file created when comparing two directories. However, there are some folders and files that appear in .diff that I want to remove from it, so I can get a cleaner .diff .

Is there any editor that allows me to do this (something like Kompare, but it should allow me to delete files from diff)? How can I specify to exclude specific directories?

+4
source share
4 answers

This is not an editor, but it looks like this: the filterdiff from patchutils does what you after:

Filterdiff will select the parts of the patch file that apply to files matching (or, alternatively, not matching) a shell pattern.

You can learn more about patchutils here and is packaged in Debian / Ubuntu as "patchutils".

+1
source

If you need to do "real editing" of the patch (diff) files, for example, adding and removing differences, adding and removing lines from diff, etc., then you might consider starting Emacs , which has a diff editing mode that does " the right thing "when you switch the diff file. It has menu actions and key bindings for “kill the current piece” and similar actions.

+1
source

Have you tried Meld ? There you can define filters to filter your comparisons. Otherwise, it is the perfect GUI for diff.

0
source

If you have control over the creation of the .diff file, I believe that the best approach is, first of all, to not include what you later want to ignore. Diff has a command line parameter --exclude-from=FILE , where you can tell it a list of all the files you want to exclude. Alternatively, you can use --exclude=PATTERN to exclude based on file name matching.

0
source

Source: https://habr.com/ru/post/1342659/


All Articles