- 1、本文档共25页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
diff和patch使用指南(国外英文资料)
diff和patch使用指南(国外英文资料)
Diff and patch are a pair of tools, mathematically speaking, diff is the difference between two sets, patch is the sum of two sets.
Diff compares the differences in the two files or collections of files, and records them to generate a diff file, which is also what we often call the patch file, the patch file.
Patch can apply the diff file to one of the original sets, resulting in another set. For example, file A and B, patch file was generated after the diff C, injection process is equivalent to A - B = C, then the process of patch is B + C = A or A - C = B.
So all we need to do is get A, B, C, any two of these three files, and we can use diff and patch to generate another file for the tool.
Thats the beauty of diff and patch. Heres a look at the usage of the two tools:
1. The use of the diff
Diff can be followed by two filenames or two directory names. If it is a directory name and a filename, then only the file name of the same name is applied in that directory.
If you have two directories, all the files under this directory will not be recursively. If we want to recurse, we need to use the -r parameter.
Command diff A B, C, A is the original file, B is the modified file, C is called A patch file.
The diff file format, which is generated without any parameters, is a simple format that only shows different lines and content. We need a more detailed format that identifies the context of the different locations, which is more conducive to improving the ability to recognize the patch command. You can use the -c switch at this time.
2. The use of the patch
Patch is used to generate the target file based on the original file and the patch file. Lets take an example
Patch A C will get B, which is called the patch of C for A.
After that, your file A becomes A file B. What if you want to get back to A after the patch?
The patch minus R B C can be restored to A.
So dont worry about losing A.
Patch is actually used without specifying the original file
文档评论(0)