SYNOPSIS
patch [options] [originalfile [patchfile]] but usually just patch -pnum <patchfile
Options
-a Treat all files as text and compare them line-by-line, even if they do not seem to be text.
-u Use the unified output format.
-r When comparing directories, recursively compare any subdirec- tories found.
-N --new-file In directory comparison, if a file is found in only one direc- tory, treat it as present but empty in the other directory.
Sample:
patch takes a patch file patchfile containing a difference listing produced by the diff program and applies those differences to one or more original files, producing patched versions.
Normally the patched versions are put in place of the originals. Backups can be made; see the -b or —backup option.
The names of the files to be patched are usually taken from the patch file, but if there's just one file to be patched it can specified on the command line as original- file.
Upon startup, patch attempts to determine the type of the diff listing, unless overruled
patch tries to skip any leading garbage, apply the diff, and then skip any trailing garbage. Thus you could feed an article or message containing a diff listing to patch, and it should work.
With context diffs, and to a lesser extent with normal diffs, patch can detect when the line numbers mentioned in the patch are incorrect, and attempts to find the correct place to apply each hunk of the patch.
If patch cannot find a place to install that hunk of the patch, it puts the hunk out to a reject file, which normally is the name of the output file plus a .rej suffix
If the patch file contains more than one patch, patch tries to apply each of them as if they came from separate patch files.