How to use the patch command

Login to reply  Page: « < 1 of 1 > »
15 Nov 2008 - 12:55829
How to use the patch command
This is pretty basic, but I'll add more as the questions come up.

patch is another tool that complements diff, it will apply the differences in the “patch” file to the target file. Think of it is a way to “patch” your old files with newer modifications.

How to use patch
To apply the patch, change into the same directory as the unmodified file and execute
patch < file.patch

This is how to apply patch to an entire directory,
patch -p0 < program.patch

Patch applied can be simply removed by adding the -R switch,
patch -p0 -R < program.patch
patch -R < file.patch


__________________
Rumble
The Builder Academy
tbamud.com 9091

Last edited by Rumble (15 Nov 2008 - 13:00)
23 Nov 2008 - 11:09831
How to patch, how to handpatch
How to hand patch
http://www.circlemud.org/cdp/wtfaq/handpatch.html

Zizazat's tutorial on how to create a patch


__________________
Rumble
The Builder Academy
tbamud.com 9091
28 Nov 2008 - 02:14832
Quote Rumble:
This is pretty basic, but I'll add more as the questions come up.

patch is another tool that complements diff, it will apply the differences in the “patch” file to the target file. Think of it is a way to “patch” your old files with newer modifications.

How to use patch
To apply the patch, change into the same directory as the unmodified file and execute
patch < file.patch

This is how to apply patch to an entire directory,
patch -p0 < program.patch

Patch applied can be simply removed by adding the -R switch,
patch -p0 -R < program.patch
patch -R < file.patch


I'd suggest when first attempting a patch to use it with the -dry-run flag so you can see if it will patch cleanly before actually doing the patching, this way you can quickly see if hand-patching may be the way to go before it begins patching and creates rejection files.

This can be done via: patch -dry-run < file.patch


__________________
Login to reply  Page: « < 1 of 1 > »