>srclfs8 [ use_patch ]# echo "bbb" >> destlfs8 [ use_patch ]# ca_1 out of 1 hunk failed">
赞
踩
一、流程
1. 通过diff 查看文件修改前后(src、dest)内容差异,并将修改内容存入目标patch文件;
2. 通过patch命令操作源文件src,将修改内容patch添加至源文件;
二、注意点
1. diff操作时,注意文件顺序,顺序出现错误将导致 后续补丁操作失败;
- lfs8 [ use_patch ]# echo "aaa" >>src
- lfs8 [ use_patch ]# echo "bbb" >> dest
- lfs8 [ use_patch ]# cat src
- aaa
- lfs8 [ use_patch ]# cat dest
- bbb
- lfs8 [ use_patch ]# diff dest src > patch //patch 失败原因:diff操作时 修改前文件在后,修改后文件在前
- lfs8 [ use_patch ]# cat patch
- 1c1
- < bbb
- ---
- > aaa
- lfs8 [ use_patch ]# /usr/bin/patch -Np0 src -i patch //patch 失败现象
- patching file src
- Reversed (or previously applied) patch detected! Skipping patch.
- 1 out of 1 hunk ignored -- saving rejects to file src.rej
- lfs8 [ use_patch ]# ls
- dest patch src src.rej
三、标准流程实操
- lfs8 [ use_patch ]# echo "aaa" >> src
- lfs8 [ use_patch ]#
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。