补丁文件和差异文件之间的区别 [英] Difference between patch and diff files

查看:63
本文介绍了补丁文件和差异文件之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以解释一下 .diff 文件和 .patch 文件之间的区别.

Could somebody explain me the difference between a .diff file and .patch file.

推荐答案

重要的是文件的内容,而不是扩展名.这两个扩展都暗示某种diff实用程序(diffgit diffgit format-patchsvn diff)产生了输出.

What matters is the content of the file, not the extension. Both of those extensions imply that some sort of diff utility (diff, git diff, git format-patch, svn diff) produced the output.

许多diff实用程序都会产生可通过patch命令应用的输出.您经常需要对patch使用-d-p选项,以使路径正确匹配(条带前缀,名称目标目录).如果您看到在线分发的文件中的这些扩展名之一,则几乎可以肯定地表明它与patch兼容.

Many diff utilities produce output which can be applied by the patch command. You will frequently need to use the -d and -p options to patch in order to get the paths matched up right (strip prefix, name target directory). If you see one of those extensions on a file distributed online, it's almost certainly an indication it's compatible with patch.

Git的diff输出与patch兼容,但我相信svn的不兼容.当然,由git diff生成的普通补丁可能最好由git apply应用,而由git format-patch生成的补丁专门设计用于git-am.

Git's diff output is compatible with patch, but I believe svn's is not. Of course, plain patches generated by git diff are probably best applied by git apply, and patches generated by git format-patch are designed for use with git-am.

这篇关于补丁文件和差异文件之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆