patch

To revert a previously applied patch, use the -R argument to patch.
 48 So, if you applied a patch like this:                                                                                                                                                                           
 49     patch -p1 < ../patch-x.y.z
 50 
 51 You can revert (undo) it like this:
 52     patch -R -p1 < ../patch-x.y.z
 53 

 54 

55 How do I feed a patch/diff file to `patch'?                                                                                                                                                                     
 56 ---
 57  This (as usual with Linux and other UNIX like operating systems) can be
 58 done in several different ways.
 59 In all the examples below I feed the file (in uncompressed form) to patch
 60 via stdin using the following syntax:
 61     patch -p1 < path/to/patch-x.y.z
 62 
 63 If you just want to be able to follow the examples below and don't want to
 64 know of more than one way to use patch, then you can stop reading this
 65 section here.
 66 
 67 Patch can also get the name of the file to use via the -i argument, like
 68 this:
 69     patch -p1 -i path/to/patch-x.y.z
 70 
 71 If your patch file is compressed with gzip or bzip2 and you don't want to
 72 uncompress it before applying it, then you can feed it to patch like this
 73 instead:
 74     zcat path/to/patch-x.y.z.gz | patch -p1
 75     bzcat path/to/patch-x.y.z.bz2 | patch -p1
 76 
 77 If you wish to uncompress the patch file by hand first before applying it
 78 (what I assume you've done in the examples below), then you simply run
 79 gunzip or bunzip2 on the file -- like this:
 80     gunzip patch-x.y.z.gz
 81     bunzip2 patch-x.y.z.bz2
 82 
 83 Which will leave you with a plain text patch-x.y.z file that you can feed to
 84 patch via stdin or the -i argument, as you prefer.
 85 
 86 A few other nice arguments for patch are -s which causes patch to be silent
 87 except for errors which is nice to prevent errors from scrolling out of the
 88 screen too fast, and --dry-run which causes patch to just print a listing of
 89 what would happen, but doesn't actually make any changes. Finally --verbose
 90 tells patch to print more information about the work being done.
 91 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值