patch的基本使用

diff -ruN old/  new/  > your_patch_file 生成new和old的patch

patch -p2 < your_patch_file  #跳过patch的filename的前2级,然后apply到当前目录

patch -RE -p2 your_patch_file  # revert刚才apply的patch,然后删除空文件

patch old_file your_patch_file # 给old_patch 打补丁

patch -R cur_file patch # 从当前文件revert掉patch
原文地址:https://www.cnblogs.com/Arnold-Zhang/p/15704726.html