patch

Name

patch -- apply a diff file to an original

Description

patch is as specified in the SUS but with differences as listed below.

Differences

--backup-if-mismatch

backs up a file if the patch does not match the file exactly and if backups are not otherwise requested.

--no-backup-if-mismatch

does not back up a file if the patch does not match the file exactly and if backups are not otherwise requested.

-B pref, --prefix=pref

prefixes pref to a file name when generating its simple backup file name.

--binary

reads and write all files in binary mode, except for standard output and /dev/tty. This option has no effect on POSIX-compliant systems.

--dry-run

prints the results of applying the patches without actually changing any files.

-E, --remove-empty-files

removes output files that are empty after the patches have been applied. When patch removes a file, it also attempts to remove any empty ancestor directories.

-f, --force

skips patches whose headers do not say which file is to be patched; patches files even though they have the wrong version for the Prereq: line in the patch; assumes that patches are not reversed even if they look like they are.

-F num, --fuzz=num

sets the maximum fuzz factor. This option only applies to diffs that have context, and ignores up to that many lines in looking for places to install a hunk.

-g num, --get=num

controls patch behavior when a file is under RCS or SCCS control and does not exist or is read-only and matches the default version. If num is positive, patch gets (or checks out) the file from the revision control system; if zero, patch ignores RCS and SCCS and does not get the file; and if negative, patch asks the user where to get the file.

-s, --silent, --quiet

works silently, unless an error occurs.

-t, --batch

suppresses questions like -f, but makes some different assumptions: skips patches whose headers do not contain file names; skips patches for which the file has the wrong version for the Prereq: line in the patch; and assumes that patches are reversed if they look like they are.

-T, --set-time

sets the modification and access times of patched files from time stamps given in context diff headers, assuming that the context diff headers use local time.

-u, --unified

interprets the patch file as a unified context diff.

-v, --version

prints out patch's revision header and patch level, and exits.

-V method, --version-control=method

uses method to determine backup file names. The method can also be given by the PATCH_VERSION_CONTROL environment variable, which is overridden by this option.

--verbose

outputs extra information about the work being done.

-Y pref, --basename-prefix=pref

prefixes pref to the basename of a file name when generating its simple backup file name.

-z suffix, --suffix=suffix

uses suffix as the simple backup suffix.

-Z, --set-utc

sets the modification and access times of patched files from time stamps given in context diff headers.

--help

displays this help and exits.