编辑差异文件

发布于 2024-10-20 20:01:31 字数 173 浏览 6 评论 0原文

我有一个通过比较两个目录生成的 .diff 文件。但是,.diff 中出现了一些文件夹和文件,我想从中删除它们,这样我就可以获得更干净的 .diff

是否有任何编辑器可以让我执行此操作(例如 Kompare,但它必须允许从差异中删除文件)?如何指定排除特定目录?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

醉城メ夜风 2024-10-27 20:01:31

它不是编辑器,但看起来 patchutils 的 filterdiff 可以满足您的需求:

Filterdiff 将选择补丁文件中适用于与 shell 通配符匹配(或者不匹配)的文件的部分。

您可以在此处找到有关 patchutils 的更多信息,它在 Debian / Ubuntu 中打包为“patchutils”。

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".

以酷 2024-10-27 20:01:31

如果您最终需要对补丁(diff)文件进行“真正的编辑”,例如添加和删除差异、添加和删除差异中的行等,那么您可能会考虑运行 Emacs 具有差异编辑模式,当您更改差异文件时,它会做“正确的事情”。它具有用于“杀死当前块”和类似操作的菜单操作和键绑定。

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.

旧伤慢歌 2024-10-27 20:01:31

您尝试过 Meld 吗?您可以在那里定义过滤器来过滤您的比较。否则它是一个完美的 diff GUI。

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

逆流 2024-10-27 20:01:31

如果您可以控制 .diff 文件的创建,我认为最好的方法是首先不包含您以后想要忽略的内容。 Diff 有一个 --exclude-from=FILE 命令行选项,您可以在其中为其提供要排除的所有文件的列表。或者,您可以使用 --exclude=PATTERN 根据文件名匹配进行排除。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文