我尝试制作一个此处介绍的补丁。
说我有两个目录,pp1(modified version)
然后用以下命令pp0(clean version)
制作一个补丁文件:pp0.patch
diff
diff -crB pp0 pp1 > pp0.patch
问题是,如果仅在pp1中有一个文件,它将不会包含在补丁中。如何解决呢?
更新:
我首先进入pp0目录,并测试补丁是否成功
patch --dry-run -p1 -i /path-to-pp0.patch
尽管我已经添加--new-file
了diff
命令,但pp1
结果中未列出仅那些
更新:
我不小心修补了错误的文件,因此
diff -crb --new-file pp1 pp0 > pp0.patch
要么
diff -crNb pp1 pp0 > pp0.patch
会做