patch

生成patch && 打patch

a为修改前,b为修改后。

单文件生成patch:

1
diff -up a/1.txt b/1.txt > patch

多文件生成patch:

1
diff -uprN a/ b/ > patch

打patch,需要切换到该目录中,用p1参数忽略第一级目录,因为目录名可能不同:

1
patch -p1 < patch1.diff