Fabián
Fabián

Reputation: 41

Edit diff files

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

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

Upvotes: 4

Views: 3329

Answers (4)

Wes Hardaker
Wes Hardaker

Reputation: 22252

If you end up needing to do "real editing" of patch (diff) files, like adding and removing diffs, adding and removing lines from a diff, etc then you might consider running Emacs which has a diff-editing mode that does the "right thing" when you go changing a diff file. It has menu actions and key bindings for "kill current chunk" and similar actions.

Upvotes: 1

hlovdal
hlovdal

Reputation: 28180

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

Upvotes: 0

posdef
posdef

Reputation: 6532

Have you tried Meld? There you can define filters to filer your comparisons. Otherwise it's a perfect GUI for diff.

Upvotes: 0

Mark Longair
Mark Longair

Reputation: 467023

It's not an editor, but it looks as if filterdiff from patchutils does what you're after:

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

You can find out more about patchutils here and it's packaged in Debian / Ubuntu as "patchutils".

Upvotes: 1

Related Questions