打补丁说明

生成补丁文件:diff (常用选项) -Nuar “版本1” “版本2” >“补丁文件”
修复打补丁:patch -p(NUM) < 补丁文件
例如:
patch –R –p0 < to-file.patch #还原操作
-p:从补丁文件中找到的每个文件名中去掉包含num前导斜杠的最小前缀.(对比源文件路径)
参考链接:https://blog.csdn.net/zhongnanjun_3/article/details/7593904
########################################################################
进入到要打补丁的文件位置:
[root@ecs-12a3dd demo]# tree
.
├── s1
│   ├── find
│   └── test.sh
├── s2
│   ├── find
│   ├── test.sh
│   └── tmp.txt
└── source.patch

2 directories, 6 files
##########################################
[root@ecs-12a3dd demo]# diff -ur s1/ s2/
Binary files s1/find and s2/find differ
diff -u s1/test.sh s2/test.sh
--- s1/test.sh 2019-04-17 16:45:46.297000000 +0800
+++ s2/test.sh 2019-04-17 16:46:58.870000000 +0800
@@ -1 +1 @@
-hello world
+hello the world
Only in s2/: tmp.txt
###############################################

posted @ 2021-02-09 14:14  笑傲运维  阅读(131)  评论(0编辑  收藏  举报