如何在Windows上创建补丁文件?

发布于 2024-08-10 00:57:26 字数 207 浏览 1 评论 0原文

在 Windows 上,我有两个源文件,想要创建一个具有差异的补丁,例如 这个。 但我不确定这个补丁是什么格式以及使用什么应用程序来创建它? GNU diff 输出与我在上面的链接中看到的补丁有很大不同。

On windows, I have two source files and want to create a patch with difference, like this one.
But I'm unsure, what format this patch is and what app to use in order to create it? GNU diff output is very different from the patch I can see in the link above.

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

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

发布评论

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

评论(8

梦里的微风 2024-08-17 00:57:26

尝试 WinMerge。您将在“工具”菜单中找到补丁生成器。

Try WinMerge. You'll find a patch generator in the "Tools" menu.

灵芸 2024-08-17 00:57:26

谢谢,PhiLho卢卡什UnxUtils 中的 diff 程序在 Windows 7 下可以很好地生成补丁文件:

diff -u oldfile newfile >patchfile

同样,UnxUtils 的补丁程序也可以很好地应用补丁:

patch -u oldfile patchfile

Thanks, PhiLho & Lukáš! The diff program from UnxUtils works great under Windows 7 to generate the patch file:

diff -u oldfile newfile >patchfile

Likewise, the patch program from UnxUtils works great to apply the patch:

patch -u oldfile patchfile
趁微风不噪 2024-08-17 00:57:26

输出格式称为“统一差异”,可以使用diff -u生成。

The output format is called "unified diff", it can be generated using diff -u.

无人问我粥可暖 2024-08-17 00:57:26

WinMerge 是 Windows 上最好的工具。
要创建补丁文件,您需要执行以下操作:

File>Open

-- 在此打开要为其生成补丁文件的文件。

Tools>Generate Patch

-- 这里指定补丁文件的保存路径。 WinMerge 将为您保存补丁文件。

WinMerge is the best tool for windows.
To create a patch file, you need to do the following:

File>Open

-- Here you open the files for which you are generating patch file.

Tools>Generate Patch

-- Here you specify the path where to save the patch file. And WinMerge will save patch file for you.

爱已欠费 2024-08-17 00:57:26

WinMerge (http://winmerge.org/) 正是您所需要的。您还可以使用此工具比较整个文件树,这对于某些人来说绝对是必备的。

WinMerge (http://winmerge.org/) is what you need. You also can compare whole file trees with this tool, which is an absolute must-have for some people.

帅哥哥的热头脑 2024-08-17 00:57:26

UnxUtils 软件包为 Windows 提供了许多有用的 Unix 工具,对 Windows 安装的影响最小(解压缩、添加位置到路径、使用它)。
它有一个 diff.exe

The UnxUtils package offers lot of useful Unix tools for Windows, with a minimal impact on Windows installation (unzip, add location to path, use it).
It has a diff.exe

想挽留 2024-08-17 00:57:26

Beyond Compare 4 中,您可以通过选择“会话”> 来生成统一差异。 “文本比较报告...”菜单项,然后为布局选择“补丁”,为补丁样式选择“统一差异”。然后将输出保存到文件或剪贴板。

In Beyond Compare 4 you can generate a unified diff by selecting the 'Session' > 'Text Compare Report...' menu item and then selecting 'Patch' for the layout and 'Unified diff' for the patch style. Then save the output to file, or to the clipboard.

↙厌世 2024-08-17 00:57:26

我还制作了一个 工具 来在两组变更集之间生成补丁文件(如 WinMerge html 格式) /folders/commits(作为从 github 或 azure 下载的 zip 或只是位于驱动器中的文件夹),因为目前 WinMerge 不支持从命令行生成路径文件以支持自动化。

像这样使用它:

python diff_generator.py --c1 "path_to_file1.zip" --c2 "path_to_file2.zip" [--git]

python diff_generator.py --c1 "path_to_folder1" --ddc1 --c2 "path_to_folder2" --ddc2

I've also made a tool to generate patch files (like WinMerge html format) between two sets of changesets/folders/commits (as a zip downloaded from github or azure or just folders sitting in your drive) since currently WinMerge does NOT support path file generation from command-line to support automation.

use it like:

python diff_generator.py --c1 "path_to_file1.zip" --c2 "path_to_file2.zip" [--git]

or

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