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