[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
15.1 Options to patch
Here is a summary of all of the options that GNU patch
accepts. See section GNU patch
and Traditional patch
, for which of these options are
safe to use in older versions of patch
.
Multiple single-letter options that do not take an argument can be combined into a single command line argument with only one dash.
- ‘-b’
- ‘--backup’
Back up the original contents of each file, even if backups would normally not be made. See section Backup Files.
- ‘-B prefix’
- ‘--prefix=prefix’
Prepend prefix to backup file names. See section Backup File Names.
- ‘--backup-if-mismatch’
Back up the original contents of each file if the patch does not exactly match the file. This is the default behavior when not conforming to POSIX. See section Backup Files.
- ‘--binary’
Read and write all files in binary mode, except for standard output and ‘/dev/tty’. This option has no effect on POSIX-conforming systems like GNU/Linux. On systems where this option makes a difference, the patch should be generated by ‘diff -a --binary’. See section Binary Files and Forcing Text Comparisons.
- ‘-c’
- ‘--context’
Interpret the patch file as a context diff. See section Selecting the
patch
Input Format.- ‘-d directory’
- ‘--directory=directory’
Make directory directory the current directory for interpreting both file names in the patch file, and file names given as arguments to other options. See section Applying Patches in Other Directories.
- ‘-D name’
- ‘--ifdef=name’
Make merged if-then-else output using name. See section Merging Files with If-then-else.
- ‘--dry-run’
Print the results of applying the patches without actually changing any files. See section Predicting what
patch
will do.- ‘-e’
- ‘--ed’
Interpret the patch file as an
ed
script. See section Selecting thepatch
Input Format.- ‘-E’
- ‘--remove-empty-files’
Remove output files that are empty after the patches have been applied. See section Creating and Removing Files.
- ‘-f’
- ‘--force’
Assume that the user knows exactly what he or she is doing, and do not ask any questions. See section Messages and Questions from
patch
.- ‘-F lines’
- ‘--fuzz=lines’
Set the maximum fuzz factor to lines. See section Helping
patch
Find Inexact Matches.- ‘-g num’
- ‘--get=num’
If num is positive, get input files from a revision control system as necessary; if zero, do not get the files; if negative, ask the user whether to get the files. See section Revision Control.
- ‘--help’
Output a summary of usage and then exit.
- ‘-i patchfile’
- ‘--input=patchfile’
Read the patch from patchfile rather than from standard input. See section Options to
patch
.- ‘-l’
- ‘--ignore-white-space’
Let any sequence of blanks (spaces or tabs) in the patch file match any sequence of blanks in the input file. See section Applying Patches with Changed White Space.
- ‘-n’
- ‘--normal’
Interpret the patch file as a normal diff. See section Selecting the
patch
Input Format.- ‘-N’
- ‘--forward’
Ignore patches that
patch
thinks are reversed or already applied. See also ‘-R’. See section Applying Reversed Patches.- ‘--no-backup-if-mismatch’
Do not back up the original contents of files. This is the default behavior when conforming to POSIX. See section Backup Files.
- ‘-o file’
- ‘--output=file’
Use file as the output file name. See section Options to
patch
.- ‘-pnumber’
- ‘--strip=number’
Set the file name strip count to number. See section Applying Patches in Other Directories.
- ‘--posix’
Conform to POSIX, as if the
POSIXLY_CORRECT
environment variable had been set. See sectionpatch
and the POSIX Standard.- ‘--quoting-style=word’
Use style word to quote names in diagnostics, as if the
QUOTING_STYLE
environment variable had been set to word. See sectionpatch
Quoting Style.- ‘-r reject-file’
- ‘--reject-file=reject-file’
Use reject-file as the reject file name. See section Reject File Names.
- ‘-R’
- ‘--reverse’
Assume that this patch was created with the old and new files swapped. See section Applying Reversed Patches.
- ‘-s’
- ‘--quiet’
- ‘--silent’
Work silently unless an error occurs. See section Messages and Questions from
patch
.- ‘-t’
- ‘--batch’
Do not ask any questions. See section Messages and Questions from
patch
.- ‘-T’
- ‘--set-time’
Set 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. See section Updating Time Stamps on Patched Files.
- ‘-u’
- ‘--unified’
Interpret the patch file as a unified diff. See section Selecting the
patch
Input Format.- ‘-v’
- ‘--version’
Output version information and then exit.
- ‘-V backup-style’
- ‘--version=control=backup-style’
Select the naming convention for backup file names. See section Backup File Names.
- ‘--verbose’
Print more diagnostics than usual. See section Messages and Questions from
patch
.- ‘-x number’
- ‘--debug=number’
Set internal debugging flags. Of interest only to
patch
patchers.- ‘-Y prefix’
- ‘--basename-prefix=prefix’
Prepend prefix to base names of backup files. See section Backup File Names.
- ‘-z suffix’
- ‘--suffix=suffix’
Use suffix as the backup extension instead of ‘.orig’ or ‘~’. See section Backup File Names.
- ‘-Z’
- ‘--set-utc’
Set the modification and access times of patched files from time stamps given in context diff headers, assuming that the context diff headers use UTC. See section Updating Time Stamps on Patched Files.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |