diff patch比较文件打补丁

比较文件将结果保存到patch文件:diff -u test1.txt test2.txt > patchfile 

test1.txt应用patch文件,并备份(test1.txt.orig):patch -b test1.txt patchfile

升级成功后test1.txt和test2.txt是一样的:diff test1.txt test2.txt

将test1.txt回退到旧版本:patch -R test1.txt patchfile

回退成功后test1.txt和test1.txt.orig是一样的:diff test1.txt test1.txt.orig

原文地址:https://www.cnblogs.com/bigcat47/p/9798556.html