📄 patch.man
字号:
.TP\fB\-i\fP \fIpatchfile\fP or \fB\*=input=\fP\fIpatchfile\fPRead the patch from.IR patchfile .If.I patchfileis.BR \- ,read from standard input, the default..TP\fB\-l\fP or \fB\*=ignore\-whitespace\fPMatch patterns loosely, in case tabs or spaceshave been munged in your files.Any sequence of one or more blanks in the patch file matches any sequencein the original file, and sequences of blanks at the ends of lines are ignored.Normal characters must still match exactly.Each line of the context must still match a line in the original file..TP\fB\-n\fP or \fB\*=normal\fPInterpret the patch file as a normal diff..TP\fB\-N\fP or \fB\*=forward\fPIgnore patches that seem to be reversed or already applied.See also.BR \-R ..TP\fB\-o\fP \fIoutfile\fP or \fB\*=output=\fP\fIoutfile\fPSend output to.I outfileinstead of patching files in place.Do not use this option if.I outfileis one of the files to be patched..TP\fB\-p\fP\fInum\fP or \fB\*=strip\fP\fB=\fP\fInum\fPStrip the smallest prefix containing.I numleading slashes from each file name found in the patch file.A sequence of one or more adjacent slashes is counted as a single slash.This controls how file names found in the patch file are treated, in caseyou keep your files in a different directory than the person who sentout the patch.For example, supposing the file name in the patch file was.Sp \fB/u/howard/src/blurfl/blurfl.c\fP.Spsetting.B \-p0gives the entire file name unmodified,.B \-p1gives.Sp \fBu/howard/src/blurfl/blurfl.c\fP.Spwithout the leading slash,.B \-p4gives.Sp \fBblurfl/blurfl.c\fP.Spand not specifying.B \-pat all just gives you \fBblurfl.c\fP.Whatever you end up with is looked for either in the current directory,or the directory specified by the.B \-doption..TP.B \*=posixConform more strictly to the \s-1POSIX\s0 standard, as follows..RS.TP 3.B " \(bu"Take the first existing file from the list (old, new, index)when intuiting file names from diff headers..TP.B " \(bu"Do not remove files that are empty after patching..TP.B " \(bu"Do not ask whether to get files from \s-1RCS\s0, ClearCase, Perforce,or \s-1SCCS\s0..TP.B " \(bu"Require that all options precede the files in the command line..TP.B " \(bu"Do not backup files when there is a mismatch..RE.TP.BI \*=quoting\-style= wordUse style.I wordto quote output names.The.I wordshould be one of the following:.RS.TP.B literalOutput names as-is..TP.B shellQuote names for the shell if they contain shell metacharacters or wouldcause ambiguous output..TP.B shell-alwaysQuote names for the shell, even if they would normally not require quoting..TP.B cQuote names as for a C language string..TP.B escapeQuote as with.B cexcept omit the surrounding double-quote characters..LPYou can specify the default value of the.B \*=quoting\-styleoption with the environment variable.BR QUOTING_STYLE .If that environment variable is not set, the default value is.BR shell ..RE.TP\fB\-r\fP \fIrejectfile\fP or \fB\*=reject\-file=\fP\fIrejectfile\fPPut rejects into.I rejectfileinstead of the default.B \&.rejfile..TP\fB\-R\fP or \fB\*=reverse\fPAssume that this patch was created with the old and new files swapped.(Yes, I'm afraid that does happen occasionally, human nature being what itis.).B patchattempts to swap each hunk around before applying it.Rejects come out in the swapped format.The.B \-Roption does not work with.B eddiff scripts because there is too littleinformation to reconstruct the reverse operation..SpIf the first hunk of a patch fails,.B patchreverses the hunk to see if it can be applied that way.If it can, you are asked if you want to have the.B \-Roption set.If it can't, the patch continues to be applied normally.(Note: this method cannot detect a reversed patch if it is a normal diffand if the first command is an append (i.e. it should have been a delete)since appends always succeed, due to the fact that a null context matchesanywhere.Luckily, most patches add or change lines rather than delete them, so mostreversed normal diffs begin with a delete, which fails, triggeringthe heuristic.).TP\fB\-s\fP or \fB\*=silent\fP or \fB\*=quiet\fPWork silently, unless an error occurs..TP\fB\-t\fP or \fB\*=batch\fPSuppress questions like.BR \-f ,but make some different assumptions:skip patches whose headers do not contain file names (the same as \fB\-f\fP);skip patches for which the file has the wrong version for the.B Prereq:\&linein the patch; and assume that patches are reversed if they look likethey are..TP\fB\-T\fP or \fB\*=set\-time\fPSet the modification and access times of patched files from time stampsgiven in context diff headers, assuming that the context diff headersuse local time. This option is not recommended, because patches usinglocal time cannot easily be used by people in other time zones, andbecause local time stamps are ambiguous when local clocks move backwardsduring daylight-saving time adjustments. Instead of using this option,generate patches with \s-1UTC\s0 and use the.B \-Zor.B \*=set\-utcoption instead..TP\fB\-u\fP or \fB\*=unified\fPInterpret the patch file as a unified context diff..TP\fB\-v\fP or \fB\*=version\fPPrint out.BR patch 'srevision header and patch level, and exit..TP\fB\-V\fP \fImethod\fP or \fB\*=version\-control=\fP\fImethod\fPUse.I methodto determinebackup file names. The method can also be given by the.B PATCH_VERSION_CONTROL(or, if that's not set, the.BR VERSION_CONTROL )environment variable, which is overridden by this option.The method does not affect whether backup files are made;it affects only the names of any backup files that are made..SpThe value of.I methodis like the \s-1GNU\s0Emacs `version-control' variable;.B patchalso recognizes synonyms thatare more descriptive. The valid values for.I methodare (unique abbreviations areaccepted):.RS.TP 3\fBexisting\fP or \fBnil\fPMake numbered backups of files that already have them,otherwise simple backups.This is the default..TP\fBnumbered\fP or \fBt\fPMake numbered backups. The numbered backup file name for.I Fis.IB F .~ N ~where.I Nis the version number..TP\fBsimple\fP or \fBnever\fPMake simple backups.The.B \-Bor.BR \*=prefix ,.B \-Yor.BR \*=basename\-prefix ,and.B \-zor.BR \*=suffixoptions specify the simple backup file name.If none of these options are given, then a simple backup suffix is used;it is the value of the.B SIMPLE_BACKUP_SUFFIXenvironment variable if set, and is.B \&.origotherwise..PPWith numbered or simple backups,if the backup file name is too long, the backup suffix.B ~is used instead; if even appending.B ~would make the name too long, then.B ~replaces the last character of the file name..RE.TP\fB\*=verbose\fPOutput extra information about the work being done..TP\fB\-x\fP \fInum\fP or \fB\*=debug=\fP\fInum\fPSet internal debugging flags of interest only to.B patchpatchers..TP\fB\-Y\fP \fIpref\fP or \fB\*=basename\-prefix=\fP\fIpref\fPPrefix.I prefto the basename of a file name when generating its simple backup file name.For example, with.B "\-Y\ .del/"the simple backup file name for.B src/patch/util.cis.BR src/patch/.del/util.c ..TP\fB\-z\fP \fIsuffix\fP or \fB\*=suffix=\fP\fIsuffix\fPUse.I suffixas the simple backup suffix.For example, with.B "\-z\ -"the simple backup file name for.B src/patch/util.cis.BR src/patch/util.c- .The backup suffix may also be specified by the.B SIMPLE_BACKUP_SUFFIXenvironment variable, which is overridden by this option..TP\fB\-Z\fP or \fB\*=set\-utc\fPSet the modification and access times of patched files from time stampsgiven in context diff headers, assuming that the context diff headersuse Coordinated Universal Time (\s-1UTC\s0, often known as \s-1GMT\s0).Also see the.B \-Tor.B \*=set\-timeoption..SpThe.B \-Zor.B \*=set\-utcand.B \-Tor.B \*=set\-timeoptions normally refrain from setting a file's time if the file's original timedoes not match the time given in the patch header, or if itscontents do not match the patch exactly. However, if the.B \-for.B \*=forceoption is given, the file time is set regardless..SpDue to the limitations of.B diffoutput format, these options cannot update the times of files whosecontents have not changed. Also, if you use these options, you should remove(e.g. with.BR "make\ clean" )all files that depend on the patched files, so that later invocations of.B makedo not get confused by the patched files' times..SH ENVIRONMENT.TP 3.B PATCH_GETThis specifies whether.B patchgets missing or read-only files from \s-1RCS\s0, ClearCase, Perforce,or \s-1SCCS\s0by default; see the.B \-gor.B \*=getoption..TP.B POSIXLY_CORRECTIf set,.B patchconforms more strictly to the \s-1POSIX\s0 standard by default:see the.B \*=posixoption..TP.B QUOTING_STYLEDefault value of the.B \*=quoting\-styleoption..TP.B SIMPLE_BACKUP_SUFFIXExtension to use for simple backup file names instead of.BR \&.orig ..TP\fBTMPDIR\fP, \fBTMP\fP, \fBTEMP\fPDirectory to put temporary files in;.B patchuses the first environment variable in this list that is set.If none are set, the default is system-dependent;it is normally.B /tmpon Unix hosts..TP\fBVERSION_CONTROL\fP or \fBPATCH_VERSION_CONTROL\fPSelects version control style; see the.B \-vor.B \*=version\-controloption..SH FILES.TP 3.IB $TMPDIR "/p\(**"temporary files.TP.B /dev/ttycontrolling terminal; used to get answers to questions asked of the user.SH "SEE ALSO".BR diff (1),
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -