{
    "content": [
        {
            "type": "text",
            "text": "# patch(1) (man)\n\n## TLDR\n\n> Patch a file (or files) with a diff file.\n\n- Apply a patch using a diff file (filenames must be included in the diff file):\n  `patch < {{patch.diff}}`\n- Apply a patch to a specific file:\n  `patch < {{patch.diff}} {{path/to/file}}`\n- Patch a file writing the result to a different file:\n  `patch < {{patch.diff}} {{path/to/input_file}} {{-o|--output}} {{path/to/output_file}}`\n- Apply a patch to the current directory:\n  `patch < {{patch.diff}} {{-p|--strip}} 1`\n- Apply the reverse of a patch:\n  `patch < {{patch.diff}} {{-R|--reverse}}`\n\n*Source: tldr-pages*\n\n---\n\n**Summary:** patch - apply a diff file to an original\n\n**Synopsis:** patch [options] [originalfile [patchfile]]\nbut usually just\npatch -pnum <patchfile\n\n## Flags\n\n| Flag | Long | Arg | Description |\n|------|------|-----|-------------|\n| -b | --backup | — | Make backup files. That is, when patching a file, rename or copy the original instead of removing it. See the -V or --ve |\n| — | --backup-if-mismatch | — | Back up a file if the patch does not match the file exactly and if backups are not other‐ wise requested. This is the de |\n| — | --no-backup-if-mismatch | — | Do not back up a file if the patch does not match the file exactly and if backups are not otherwise requested. This is t |\n| -B | — | — | Use the simple method to determine backup file names (see the -V method or --version-con‐‐ trol method option), and appe |\n| — | --binary | — | Write all files in binary mode, except for standard output and /dev/tty. When reading, disable the heuristic for transfo |\n| -c | --context | — | Interpret the patch file as a ordinary context diff. |\n| -d | — | — | Change to the directory dir immediately, before doing anything else. |\n| -D | — | — | Use the #ifdef ... #endif construct to mark changes, with define as the differentiating symbol. |\n| — | --dry-run | — | Print the results of applying the patches without actually changing any files. |\n| -e | --ed | — | Interpret the patch file as an ed script. |\n| -E | --remove-empty-files | — | Remove output files that are empty after the patches have been applied. Normally this op‐ tion is unnecessary, since pat |\n| -f | --force | — | Assume that the user knows exactly what he or she is doing, and do not ask any questions. Skip patches whose headers do  |\n| -F | — | — | Set the maximum fuzz factor. This option only applies to diffs that have context, and causes patch to ignore up to that  |\n| -g | — | — | This option controls patch's actions when a file is under RCS or SCCS control, and does not exist or is read-only and ma |\n| — | --help | — | Print a summary of options and exit. |\n| -i | — | — | Read the patch from patchfile. If patchfile is -, read from standard input, the default. |\n| -l | --ignore-whitespace | — | Match patterns loosely, in case tabs or spaces have been munged in your files. Any se‐ quence of one or more blanks in t |\n| -n | --normal | — | Interpret the patch file as a normal diff. |\n| -N | --forward | — | When a patch does not apply, patch usually checks if the patch looks like it has been ap‐ plied already by trying to rev |\n| -o | — | — | Send output to outfile instead of patching files in place. Do not use this option if out‐ file is one of the files to be |\n| -p | — | — | Strip the smallest prefix containing num leading slashes from each file name found in the patch file. A sequence of one  |\n| — | --posix | — | Conform more strictly to the POSIX standard, as follows. •• Take the first existing file from the list (old, new, index) |\n| -r | — | — | Put rejects into rejectfile instead of the default .rej file. When rejectfile is -, dis‐ card rejects. |\n| -R | --reverse | — | Assume that this patch was created with the old and new files swapped. (Yes, I'm afraid that does happen occasionally, h |\n| -s | --quiet | — | Work silently, unless an error occurs. |\n| — | --follow-symlinks | — | When looking for input files, follow symbolic links. Replaces the symbolic links, instead of modifying the files the sym |\n| -t | --batch | — | Suppress questions like -f, but make some different assumptions: skip patches whose head‐ ers do not contain file names  |\n| -T | --set-time | — | Set the modification and access times of patched files from time stamps given in context diff headers. Unless specified  |\n| -u | --unified | — | Interpret the patch file as a unified context diff. |\n| -v | --version | — | Print out patch's revision header and patch level, and exit. |\n| -V | — | — | Use method to determine backup file names. The method can also be given by the PATCHVER‐‐ SIONCONTROL (or, if that's not |\n| — | --verbose | — | Output extra information about the work being done. |\n| -x | — | — | Set internal debugging flags of interest only to patch patchers. |\n| -Y | — | — | Use the simple method to determine backup file names (see the -V method or --version-con‐‐ trol method option), and pref |\n| -z | — | — | Use the simple method to determine backup file names (see the -V method or --version-con‐‐ trol method option), and use  |\n| -Z | --set-utc | — | Set the modification and access times of patched files from time stamps given in context diff headers. Unless specified  |\n\n## See Also\n\n- diff(1)\n- ed(1)\n- merge(1)\n\n## Section Outline\n\n- **NAME** (2 lines)\n- **SYNOPSIS** (6 lines)\n- **DESCRIPTION** (8 lines) — 1 subsections\n  - -c --context -e --ed -n --normal -u --unified (96 lines)\n- **OPTIONS** (1 lines) — 36 subsections\n  - -b --backup (4 lines)\n  - --backup-if-mismatch (3 lines)\n  - --no-backup-if-mismatch (3 lines)\n  - -B --prefix= (5 lines)\n  - --binary (7 lines)\n  - -c --context (2 lines)\n  - -d --directory= (2 lines)\n  - -D --ifdef= (3 lines)\n  - --dry-run (2 lines)\n  - -e --ed (2 lines)\n  - -E --remove-empty-files (7 lines)\n  - -f --force (6 lines)\n  - -F --fuzz= (6 lines)\n  - -g --get= (8 lines)\n  - --help (2 lines)\n  - -i --input= (2 lines)\n  - -l --ignore-whitespace (24 lines)\n  - -n --normal (2 lines)\n  - -N --forward (4 lines)\n  - -o --output= (4 lines)\n  - -p --strip= (19 lines)\n  - --posix (32 lines)\n  - -r --reject-file= (3 lines)\n  - -R --reverse (23 lines)\n  - -s --silent --quiet (2 lines)\n  - --follow-symlinks (5 lines)\n  - -t --batch (5 lines)\n  - -T --set-time (10 lines)\n  - -u --unified (2 lines)\n  - -v --version (2 lines)\n  - -V --version-control= (27 lines)\n  - --verbose (2 lines)\n  - -x --debug= (2 lines)\n  - -Y --basename-prefix= (5 lines)\n  - -z --suffix= (4 lines)\n  - -Z --set-utc (15 lines)\n- **ENVIRONMENT** (22 lines)\n- **FILES** (3 lines) — 1 subsections\n  - /dev/tty (2 lines)\n- **SEE ALSO** (5 lines)\n- **NOTES FOR PATCH SENDERS** (57 lines)\n- **DIAGNOSTICS** (11 lines)\n- **CAVEATS** (16 lines)\n- **COMPATIBILITY ISSUES** (57 lines)\n- **BUGS** (13 lines)\n- **COPYING** (16 lines)\n- **AUTHORS** (9 lines)\n\n## Full Content\n\n### NAME\n\npatch - apply a diff file to an original\n\n### SYNOPSIS\n\npatch [options] [originalfile [patchfile]]\n\nbut usually just\n\npatch -pnum <patchfile\n\n### DESCRIPTION\n\npatch  takes a patch file patchfile containing a difference listing produced by the diff pro‐\ngram and applies those differences to one or more original files, producing patched versions.\nNormally  the  patched  versions are put in place of the originals.  Backups can be made; see\nthe -b or --backup option.  The names of the files to be patched are usually taken  from  the\npatch  file,  but  if  there's just one file to be patched it can be specified on the command\nline as originalfile.\n\nUpon startup, patch attempts to determine the type of the diff listing, unless overruled by a\n\n#### -c --context -e --ed -n --normal -u --unified\n\nstyle, new-style, and unified) and normal diffs are applied  by  the  patch  program  itself,\nwhile ed diffs are simply fed to the ed(1) editor via a pipe.\n\npatch  tries to skip any leading garbage, apply the diff, and then skip any trailing garbage.\nThus you could feed an article or message containing a diff listing to patch, and  it  should\nwork.   If  the entire diff is indented by a consistent amount, if lines end in CRLF, or if a\ndiff is encapsulated one or more times by prepending \"- \" to lines starting with \"-\" as spec‐\nified  by Internet RFC 934, this is taken into account.  After removing indenting or encapsu‐\nlation, lines beginning with # are ignored, as they are considered to be comments.\n\nWith context diffs, and to a lesser extent with normal diffs, patch can detect when the  line\nnumbers mentioned in the patch are incorrect, and attempts to find the correct place to apply\neach hunk of the patch.  As a first guess, it takes the line number mentioned for  the  hunk,\nplus  or  minus  any  offset  used in applying the previous hunk.  If that is not the correct\nplace, patch scans both forwards and backwards for a set of lines matching the context  given\nin the hunk.  First patch looks for a place where all lines of the context match.  If no such\nplace is found, and it's a context diff, and the maximum fuzz factor is set  to  1  or  more,\nthen  another  scan  takes place ignoring the first and last line of context.  If that fails,\nand the maximum fuzz factor is set to 2 or more, the first two and last two lines of  context\nare ignored, and another scan is made.  (The default maximum fuzz factor is 2.)\n\nHunks  with  less  prefix context than suffix context (after applying fuzz) must apply at the\nstart of the file if their first line number is 1.  Hunks with more prefix context than  suf‐\nfix context (after applying fuzz) must apply at the end of the file.\n\nIf patch cannot find a place to install that hunk of the patch, it puts the hunk out to a re‐\nject file, which normally is the name of the output file plus a .rej suffix,  or  #  if  .rej\nwould  generate  a file name that is too long (if even appending the single character # makes\nthe file name too long, then # replaces the file name's last character).\n\nThe rejected hunk comes out in unified or context diff format.  If the  input  was  a  normal\ndiff, many of the contexts are simply null.  The line numbers on the hunks in the reject file\nmay be different than in the patch file: they reflect the approximate location  patch  thinks\nthe failed hunks belong in the new file rather than the old one.\n\nAs  each hunk is completed, you are told if the hunk failed, and if so which line (in the new\nfile) patch thought the hunk should go on.  If the hunk is installed at a different line from\nthe  line  number  specified in the diff, you are told the offset.  A single large offset may\nindicate that a hunk was installed in the wrong place.  You are also told if  a  fuzz  factor\nwas  used  to  make  the match, in which case you should also be slightly suspicious.  If the\n--verbose option is given, you are also told about hunks that match exactly.\n\nIf no original file origfile is specified on the command line, patch tries to figure out from\nthe leading garbage what the name of the file to edit is, using the following rules.\n\nFirst, patch takes an ordered list of candidate file names as follows:\n\n•• If  the  header  is  that of a context diff, patch takes the old and new file names in the\nheader.  A name is ignored if it does not have enough slashes  to  satisfy  the  -pnum  or\n--strip=num option.  The name /dev/null is also ignored.\n\n•• If  there is an Index: line in the leading garbage and if either the old and new names are\nboth absent or if patch is conforming to POSIX, patch takes the name in the Index: line.\n\n•• For the purpose of the following rules, the candidate file names are considered to  be  in\nthe order (old, new, index), regardless of the order that they appear in the header.\n\nThen patch selects a file name from the candidate list as follows:\n\n•• If some of the named files exist, patch selects the first name if conforming to POSIX, and\nthe best name otherwise.\n\n•• If patch is not ignoring RCS, ClearCase, Perforce, and SCCS (see the -g num  or  --get=num\noption),  and  no  named  files  exist  but an RCS, ClearCase, Perforce, or SCCS master is\nfound, patch selects the first named file with an RCS, ClearCase, Perforce, or  SCCS  mas‐\nter.\n\n•• If no named files exist, no RCS, ClearCase, Perforce, or SCCS master was found, some names\nare given, patch is not conforming to POSIX, and the patch appears to create a file, patch\nselects the best name requiring the creation of the fewest directories.\n\n•• If  no file name results from the above heuristics, you are asked for the name of the file\nto patch, and patch selects that name.\n\nTo determine the best of a nonempty list of file names, patch first takes all the names  with\nthe  fewest  path  name  components;  of those, it then takes all the names with the shortest\nbasename; of those, it then takes all the shortest names; finally, it takes the first remain‐\ning name.\n\nAdditionally, if the leading garbage contains a Prereq: line, patch takes the first word from\nthe prerequisites line (normally a version number) and checks the original  file  to  see  if\nthat word can be found.  If not, patch asks for confirmation before proceeding.\n\nThe  upshot  of  all this is that you should be able to say, while in a news interface, some‐\nthing like the following:\n\n| patch -d /usr/src/local/blurfl\n\nand patch a file in the blurfl directory directly from the article containing the patch.\n\nIf the patch file contains more than one patch, patch tries to apply each of them as if  they\ncame  from separate patch files.  This means, among other things, that it is assumed that the\nname of the file to patch must be determined for each diff listing, and that the garbage  be‐\nfore  each diff listing contains interesting things such as file names and revision level, as\nmentioned previously.\n\n### OPTIONS\n\n#### -b --backup\n\nMake backup files.  That is, when patching a file, rename or copy the original instead  of\nremoving  it.   See  the  -V or --version-control option for details about how backup file\nnames are determined.\n\n#### --backup-if-mismatch\n\nBack up a file if the patch does not match the file exactly and if backups are not  other‐\nwise requested.  This is the default unless patch is conforming to POSIX.\n\n#### --no-backup-if-mismatch\n\nDo  not back up a file if the patch does not match the file exactly and if backups are not\notherwise requested.  This is the default if patch is conforming to POSIX.\n\n#### -B --prefix=\n\nUse the simple method to determine backup file names (see the -V method or  --version-con‐‐\ntrol  method option), and append pref to a file name when generating its backup file name.\nFor  example,  with  -B /junk/  the  simple  backup  file  name  for  src/patch/util.c  is\n/junk/src/patch/util.c.\n\n#### --binary\n\nWrite  all  files  in binary mode, except for standard output and /dev/tty.  When reading,\ndisable the heuristic for transforming CRLF line endings into LF line endings.   This  op‐\ntion  is  needed  on POSIX systems when applying patches generated on non-POSIX systems to\nnon-POSIX files.  (On POSIX systems, file reads and writes never transform  line  endings.\nOn  Windows,  reads and writes do transform line endings by default, and patches should be\ngenerated by diff --binary when line endings are significant.)\n\n#### -c --context\n\nInterpret the patch file as a ordinary context diff.\n\n#### -d --directory=\n\nChange to the directory dir immediately, before doing anything else.\n\n#### -D --ifdef=\n\nUse the #ifdef ... #endif construct to mark changes, with define  as  the  differentiating\nsymbol.\n\n#### --dry-run\n\nPrint the results of applying the patches without actually changing any files.\n\n#### -e --ed\n\nInterpret the patch file as an ed script.\n\n#### -E --remove-empty-files\n\nRemove output files that are empty after the patches have been applied.  Normally this op‐\ntion is unnecessary, since patch can examine the time stamps on the  header  to  determine\nwhether  a  file should exist after patching.  However, if the input is not a context diff\nor if patch is conforming to POSIX, patch does not remove empty patched files unless  this\noption is given.  When patch removes a file, it also attempts to remove any empty ancestor\ndirectories.\n\n#### -f --force\n\nAssume that the user knows exactly what he or she is doing, and do not ask any  questions.\nSkip patches whose headers do not say which file is to be patched; patch files even though\nthey have the wrong version for the Prereq: line in the patch; and assume that patches are\nnot  reversed  even if they look like they are.  This option does not suppress commentary;\nuse -s for that.\n\n#### -F --fuzz=\n\nSet the maximum fuzz factor.  This option only applies to diffs  that  have  context,  and\ncauses patch to ignore up to that many lines of context in looking for places to install a\nhunk.  Note that a larger fuzz factor increases the odds of a faulty patch.   The  default\nfuzz  factor  is 2.  A fuzz factor greater than or equal to the number of lines of context\nin the context diff, ordinarily 3, ignores all context.\n\n#### -g --get=\n\nThis option controls patch's actions when a file is under RCS or SCCS  control,  and  does\nnot  exist  or  is  read-only  and  matches  the  default version, or when a file is under\nClearCase or Perforce control and does not exist.  If num  is  positive,  patch  gets  (or\nchecks  out)  the  file  from  the  revision  control  system; if zero, patch ignores RCS,\nClearCase, Perforce, and SCCS and does not get the file; and if negative, patch  asks  the\nuser  whether  to get the file.  The default value of this option is given by the value of\nthe PATCHGET environment variable if it is set; if not, the default value is zero.\n\n#### --help\n\nPrint a summary of options and exit.\n\n#### -i --input=\n\nRead the patch from patchfile.  If patchfile is -, read from standard input, the default.\n\n#### -l --ignore-whitespace\n\nMatch patterns loosely, in case tabs or spaces have been munged in your  files.   Any  se‐\nquence  of one or more blanks in the patch file matches any sequence in the original file,\nand sequences of blanks at the ends of lines are ignored.  Normal  characters  must  still\nmatch exactly.  Each line of the context must still match a line in the original file.\n\n--merge or --merge=merge or --merge=diff3\nMerge a patch file into the original files similar to diff3(1) or merge(1).  If a conflict\nis found, patch outputs a warning and brackets  the  conflict  with  <<<<<<<  and  >>>>>>>\nlines.  A typical conflict will look like this:\n\n<<<<<<<\nlines from the original file\n|||||||\noriginal lines from the patch\n=======\nnew lines from the patch\n>>>>>>>\n\nThe  optional  argument  of  --merge determines the output format for conflicts: the diff3\nformat shows the ||||||| section with the original lines from the patch; in the merge for‐\nmat, this section is missing.  The merge format is the default.\n\nThis option implies --forward and does not take the --fuzz=num option into account.\n\n#### -n --normal\n\nInterpret the patch file as a normal diff.\n\n#### -N --forward\n\nWhen  a patch does not apply, patch usually checks if the patch looks like it has been ap‐\nplied already by trying to reverse-apply the first hunk.  The  --forward  option  prevents\nthat.  See also -R.\n\n#### -o --output=\n\nSend output to outfile instead of patching files in place.  Do not use this option if out‐\nfile is one of the files to be patched.  When outfile is -, send output to  standard  out‐\nput, and send any messages that would usually go to standard output to standard error.\n\n#### -p --strip=\n\nStrip  the smallest prefix containing num leading slashes from each file name found in the\npatch file.  A sequence of one or more adjacent slashes is  counted  as  a  single  slash.\nThis  controls  how  file names found in the patch file are treated, in case you keep your\nfiles in a different directory than the person who sent out the patch.  For example,  sup‐\nposing the file name in the patch file was\n\n/u/howard/src/blurfl/blurfl.c\n\nsetting -p0 gives the entire file name unmodified, -p1 gives\n\nu/howard/src/blurfl/blurfl.c\n\nwithout the leading slash, -p4 gives\n\nblurfl/blurfl.c\n\nand not specifying -p at all just gives you blurfl.c.  Whatever you end up with is looked for\neither in the current directory, or the directory specified by the -d option.\n\n#### --posix\n\nConform more strictly to the POSIX standard, as follows.\n\n•• Take the first existing file from the list (old, new, index) when intuiting file  names\nfrom diff headers.\n\n•• Do not remove files that are empty after patching.\n\n•• Do not ask whether to get files from RCS, ClearCase, Perforce, or SCCS.\n\n•• Require that all options precede the files in the command line.\n\n•• Do not backup files when there is a mismatch.\n\n--quoting-style=word\nUse style word to quote output names.  The word should be one of the following:\n\nliteral\nOutput names as-is.\n\nshell  Quote  names  for the shell if they contain shell metacharacters or would cause am‐\nbiguous output.\n\nshell-always\nQuote names for the shell, even if they would normally not require quoting.\n\nc      Quote names as for a C language string.\n\nescape Quote as with c except omit the surrounding double-quote characters.\n\nYou can specify the default value of the --quoting-style option with the environment vari‐\nable QUOTINGSTYLE.  If that environment variable is not set, the default value is shell.\n\n#### -r --reject-file=\n\nPut  rejects into rejectfile instead of the default .rej file.  When rejectfile is -, dis‐\ncard rejects.\n\n#### -R --reverse\n\nAssume that this patch was created with the old and new files swapped.  (Yes,  I'm  afraid\nthat  does  happen  occasionally,  human nature being what it is.)  patch attempts to swap\neach hunk around before applying it.  Rejects come out in the swapped format.  The -R  op‐\ntion  does not work with ed diff scripts because there is too little information to recon‐\nstruct the reverse operation.\n\nIf the first hunk of a patch fails, patch reverses the hunk to see if it  can  be  applied\nthat  way.   If it can, you are asked if you want to have the -R option set.  If it can't,\nthe patch continues to be applied normally.  (Note: this method cannot detect  a  reversed\npatch  if  it  is a normal diff and if the first command is an append (i.e. it should have\nbeen a delete) since appends always succeed, due to the fact that a null  context  matches\nanywhere.   Luckily, most patches add or change lines rather than delete them, so most re‐\nversed normal diffs begin with a delete, which fails, triggering the heuristic.)\n\n--read-only=behavior\nBehave as requested when trying to modify a read-only file: ignore the potential  problem,\nwarn about it (the default), or fail.\n\n--reject-format=format\nProduce  reject  files  in the specified format (either context or unified).  Without this\noption, rejected hunks come out in unified diff format if the input patch was of that for‐\nmat, otherwise in ordinary context diff form.\n\n#### -s --silent --quiet\n\nWork silently, unless an error occurs.\n\n#### --follow-symlinks\n\nWhen looking for input files, follow symbolic links.  Replaces the symbolic links, instead\nof modifying the files the symbolic links point to.  Git-style patches to  symbolic  links\nwill  no  longer apply.  This option exists for backwards compatibility with previous ver‐\nsions of patch; its use is discouraged.\n\n#### -t --batch\n\nSuppress questions like -f, but make some different assumptions: skip patches whose  head‐\ners  do  not  contain file names (the same as -f); skip patches for which the file has the\nwrong version for the Prereq: line in the patch; and assume that patches are  reversed  if\nthey look like they are.\n\n#### -T --set-time\n\nSet  the  modification and access times of patched files from time stamps given in context\ndiff headers.  Unless specified in the time stamps, assume that the context  diff  headers\nuse local time.\n\nUse of this option with time stamps that do not include time zones is not recommended, be‐\ncause patches using local time cannot easily be used by people in other  time  zones,  and\nbecause  local time stamps are ambiguous when local clocks move backwards during daylight-\nsaving time adjustments.  Make sure that time  stamps  include  time  zones,  or  generate\npatches with UTC and use the -Z or --set-utc option instead.\n\n#### -u --unified\n\nInterpret the patch file as a unified context diff.\n\n#### -v --version\n\nPrint out patch's revision header and patch level, and exit.\n\n#### -V --version-control=\n\nUse method to determine backup file names.  The method can also be given by the PATCHVER‐‐\nSIONCONTROL (or, if that's not set, the VERSIONCONTROL) environment variable,  which  is\noverridden  by  this option.  The method does not affect whether backup files are made; it\naffects only the names of any backup files that are made.\n\nThe value of method is like the GNU Emacs `version-control' variable;  patch  also  recog‐\nnizes  synonyms that are more descriptive.  The valid values for method are (unique abbre‐\nviations are accepted):\n\nexisting  or  nil\nMake numbered backups of files that already have them, otherwise simple backups.   This\nis the default.\n\nnumbered  or  t\nMake  numbered  backups.   The  numbered backup file name for F is F.~N~ where N is the\nversion number.\n\nsimple  or  never\nMake simple backups.  The -B or --prefix, -Y or --basename-prefix, and -z  or  --suffix\noptions  specify the simple backup file name.  If none of these options are given, then\na simple backup suffix is used; it is the value of the SIMPLEBACKUPSUFFIX environment\nvariable if set, and is .orig otherwise.\n\nWith  numbered or simple backups, if the backup file name is too long, the backup suffix ~\nis used instead; if even appending ~ would make the name too long,  then  ~  replaces  the\nlast character of the file name.\n\n#### --verbose\n\nOutput extra information about the work being done.\n\n#### -x --debug=\n\nSet internal debugging flags of interest only to patch patchers.\n\n#### -Y --basename-prefix=\n\nUse  the simple method to determine backup file names (see the -V method or --version-con‐‐\ntrol method option), and prefix pref to the basename of a file name  when  generating  its\nbackup   file  name.   For  example,  with  -Y .del/  the  simple  backup  file  name  for\nsrc/patch/util.c is src/patch/.del/util.c.\n\n#### -z --suffix=\n\nUse the simple method to determine backup file names (see the -V method or  --version-con‐‐\ntrol method option), and use suffix as the suffix.  For example, with -z - the backup file\nname for src/patch/util.c is src/patch/util.c-.\n\n#### -Z --set-utc\n\nSet the modification and access times of patched files from time stamps given  in  context\ndiff  headers.  Unless  specified in the time stamps, assume that the context diff headers\nuse Coordinated Universal Time (UTC, often known as GMT).  Also see the -T  or  --set-time\noption.\n\nThe  -Z  or  --set-utc and -T or --set-time options normally refrain from setting a file's\ntime if the file's original time does not match the time given in the patch header, or  if\nits  contents  do  not  match  the patch exactly.  However, if the -f or --force option is\ngiven, the file time is set regardless.\n\nDue to the limitations of diff output format, these options cannot  update  the  times  of\nfiles  whose contents have not changed.  Also, if you use these options, you should remove\n(e.g. with make clean) all files that depend on the patched files, so that  later  invoca‐\ntions of make do not get confused by the patched files' times.\n\n### ENVIRONMENT\n\nPATCHGET\nThis  specifies  whether  patch  gets missing or read-only files from RCS, ClearCase, Per‐\nforce, or SCCS by default; see the -g or --get option.\n\nPOSIXLYCORRECT\nIf set, patch conforms more strictly to the POSIX standard by default: see the --posix op‐\ntion.\n\nQUOTINGSTYLE\nDefault value of the --quoting-style option.\n\nSIMPLEBACKUPSUFFIX\nExtension to use for simple backup file names instead of .orig.\n\nTMPDIR, TMP, TEMP\nDirectory  to  put  temporary  files in; patch uses the first environment variable in this\nlist that is set.  If none are set, the default is system-dependent; it is  normally  /tmp\non Unix hosts.\n\nVERSIONCONTROL or PATCHVERSIONCONTROL\nSelects version control style; see the -v or --version-control option.\n\n### FILES\n\n$TMPDIR/p*\ntemporary files\n\n#### /dev/tty\n\ncontrolling terminal; used to get answers to questions asked of the user\n\n### SEE ALSO\n\ndiff(1), ed(1), merge(1).\n\nMarshall  T. Rose and Einar A. Stefferud, Proposed Standard for Message Encapsulation, Inter‐\nnet RFC 934 <URL:ftp://ftp.isi.edu/in-notes/rfc934.txt> (1985-01).\n\n### NOTES FOR PATCH SENDERS\n\nThere are several things you should bear in mind if you are going to be sending out patches.\n\nCreate your patch systematically.  A good method is the command diff -Naur old new where  old\nand  new  identify the old and new directories.  The names old and new should not contain any\nslashes.  The diff command's headers should have dates and times in Universal Time using tra‐\nditional  Unix  format, so that patch recipients can use the -Z or --set-utc option.  Here is\nan example command, using Bourne shell syntax:\n\nLCALL=C TZ=UTC0 diff -Naur gcc-2.7 gcc-2.8\n\nTell your recipients how to apply the patch by telling them which directory  to  cd  to,  and\nwhich  patch  options to use.  The option string -Np1 is recommended.  Test your procedure by\npretending to be a recipient and applying your patch to a copy of the original files.\n\nYou can save people a lot of grief by keeping a patchlevel.h file which is patched to  incre‐\nment  the patch level as the first diff in the patch file you send out.  If you put a Prereq:\nline in with the patch, it won't let them apply patches out of order without some warning.\n\nYou can create a file by sending out a diff that compares /dev/null or an  empty  file  dated\nthe  Epoch  (1970-01-01 00:00:00 UTC) to the file you want to create.  This only works if the\nfile you want to create doesn't exist already in the target directory.  Conversely,  you  can\nremove  a  file  by  sending  out a context diff that compares the file to be deleted with an\nempty file dated the Epoch.  The file will be removed unless patch is conforming to POSIX and\nthe  -E  or  --remove-empty-files  option is not given.  An easy way to generate patches that\ncreate and remove files is to use GNU diff's -N or --new-file option.\n\nIf the recipient is supposed to use the -pN option, do not send output that looks like this:\n\ndiff -Naur v2.0.29/prog/README prog/README\n--- v2.0.29/prog/README   Mon Mar 10 15:13:12 1997\n+++ prog/README   Mon Mar 17 14:58:22 1997\n\nbecause the two file names have different numbers of slashes, and different versions of patch\ninterpret  the  file names differently.  To avoid confusion, send output that looks like this\ninstead:\n\ndiff -Naur v2.0.29/prog/README v2.0.30/prog/README\n--- v2.0.29/prog/README   Mon Mar 10 15:13:12 1997\n+++ v2.0.30/prog/README   Mon Mar 17 14:58:22 1997\n\n\nAvoid sending patches that compare backup file names like README.orig, since this might  con‐\nfuse  patch into patching a backup file instead of the real file.  Instead, send patches that\ncompare the same base file names in different directories, e.g. old/README and new/README.\n\nTake care not to send out reversed patches, since it makes people wonder whether they already\napplied the patch.\n\nTry  not  to  have  your patch modify derived files (e.g. the file configure where there is a\nline configure: configure.in in your makefile), since the recipient should be able to  regen‐\nerate  the derived files anyway.  If you must send diffs of derived files, generate the diffs\nusing UTC, have the recipients apply the patch with the -Z or --set-utc option, and have them\nremove any unpatched files that depend on patched files (e.g. with make clean).\n\nWhile  you  may  be  able to get away with putting 582 diff listings into one file, it may be\nwiser to group related patches into separate files in case something goes haywire.\n\n### DIAGNOSTICS\n\nDiagnostics generally indicate that patch couldn't parse your patch file.\n\nIf the --verbose option is given, the message Hmm... indicates that there is unprocessed text\nin  the  patch  file  and that patch is attempting to intuit whether there is a patch in that\ntext and, if so, what kind of patch it is.\n\npatch's exit status is 0 if all hunks are applied successfully, 1 if some hunks cannot be ap‐\nplied or there were merge conflicts, and 2 if there is more serious trouble.  When applying a\nset of patches in a loop it behooves you to check this exit status so you don't apply a later\npatch to a partially patched file.\n\n### CAVEATS\n\nContext diffs cannot reliably represent the creation or deletion of empty files, empty direc‐\ntories, or special files such as symbolic links.  Nor can  they  represent  changes  to  file\nmetadata  like  ownership,  permissions,  or  whether one file is a hard link to another.  If\nchanges like these are also required, separate instructions (e.g. a shell script)  to  accom‐\nplish them should accompany the patch.\n\npatch  cannot  tell if the line numbers are off in an ed script, and can detect bad line num‐\nbers in a normal diff only when it finds a change or deletion.  A  context  diff  using  fuzz\nfactor  3 may have the same problem.  You should probably do a context diff in these cases to\nsee if the changes made sense.  Of course, compiling without errors is a pretty good  indica‐\ntion that the patch worked, but not always.\n\npatch  usually  produces the correct results, even when it has to do a lot of guessing.  How‐\never, the results are guaranteed to be correct only when the patch is applied to exactly  the\nsame version of the file that the patch was generated from.\n\n### COMPATIBILITY ISSUES\n\nThe  POSIX  standard  specifies behavior that differs from patch's traditional behavior.  You\nshould be aware of these differences if you must interoperate with  patch  versions  2.1  and\nearlier, which do not conform to POSIX.\n\n•• In  traditional  patch, the -p option's operand was optional, and a bare -p was equivalent\nto -p0.  The -p option now requires an operand, and -p 0 is now equivalent  to  -p0.   For\nmaximum compatibility, use options like -p0 and -p1.\n\nAlso,  traditional  patch  simply  counted slashes when stripping path prefixes; patch now\ncounts pathname components.  That is, a sequence of  one  or  more  adjacent  slashes  now\ncounts as a single slash.  For maximum portability, avoid sending patches containing // in\nfile names.\n\n•• In traditional patch, backups were enabled by default.  This behavior is now enabled  with\nthe -b or --backup option.\n\nConversely, in POSIX patch, backups are never made, even when there is a mismatch.  In GNU\npatch, this behavior is enabled with the --no-backup-if-mismatch option, or by  conforming\nto POSIX with the --posix option or by setting the POSIXLYCORRECT environment variable.\n\nThe -b suffix option of traditional patch is equivalent to the -b -z suffix options of GNU\npatch.\n\n•• Traditional patch used a complicated (and incompletely documented) method  to  intuit  the\nname  of  the  file  to  be patched from the patch header.  This method did not conform to\nPOSIX, and had a few gotchas.  Now patch uses a different, equally complicated (but better\ndocumented) method that is optionally POSIX-conforming; we hope it has fewer gotchas.  The\ntwo methods are compatible if the file names in the context diff  header  and  the  Index:\nline  are all identical after prefix-stripping.  Your patch is normally compatible if each\nheader's file names all contain the same number of slashes.\n\n•• When traditional patch asked the user a question, it sent the question to  standard  error\nand  looked  for  an answer from the first file in the following list that was a terminal:\nstandard error, standard output, /dev/tty, and standard input.  Now patch sends  questions\nto  standard  output  and gets answers from /dev/tty.  Defaults for some answers have been\nchanged so that patch never goes into an infinite loop when using default answers.\n\n•• Traditional patch exited with a status value that counted the number of bad hunks, or with\nstatus  1  if there was real trouble.  Now patch exits with status 1 if some hunks failed,\nor with 2 if there was real trouble.\n\n•• Limit yourself to the following options when sending instructions meant to be executed  by\nanyone  running  GNU  patch, traditional patch, or a patch that conforms to POSIX.  Spaces\nare significant in the following list, and operands are required.\n\n-c\n-d dir\n-D define\n-e\n-l\n-n\n-N\n-o outfile\n-pnum\n-R\n-r rejectfile\n\n### BUGS\n\nPlease report bugs via email to <bug-patch@gnu.org>.\n\nIf code has been duplicated (for instance with #ifdef OLDCODE ... #else ... #endif), patch is\nincapable  of  patching  both  versions, and, if it works at all, will likely patch the wrong\none, and tell you that it succeeded to boot.\n\nIf you apply a patch you've already applied, patch thinks it is a reversed patch, and  offers\nto un-apply the patch.  This could be construed as a feature.\n\nComputing  how  to  merge  a hunk is significantly harder than using the standard fuzzy algo‐\nrithm.  Bigger hunks, more context, a bigger offset from the original location, and  a  worse\nmatch all slow the algorithm down.\n\n### COPYING\n\nCopyright (C) 1984, 1985, 1986, 1988 Larry Wall.\nCopyright  (C)  1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,\n2002, 2009 Free Software Foundation, Inc.\n\nPermission is granted to make and distribute verbatim copies  of  this  manual  provided  the\ncopyright notice and this permission notice are preserved on all copies.\n\nPermission  is granted to copy and distribute modified versions of this manual under the con‐\nditions for verbatim copying, provided that the entire resulting derived work is  distributed\nunder the terms of a permission notice identical to this one.\n\nPermission  is  granted  to copy and distribute translations of this manual into another lan‐\nguage, under the above conditions for modified versions, except that this  permission  notice\nmay  be included in translations approved by the copyright holders instead of in the original\nEnglish.\n\n### AUTHORS\n\nLarry Wall wrote the original version of patch.  Paul Eggert removed patch's  arbitrary  lim‐\nits; added support for binary files, setting file times, and deleting files; and made it con‐\nform better to POSIX.  Other contributors include Wayne Davison, who added  unidiff  support,\nand  David  MacKenzie,  who added configuration and backup support.  Andreas Grünbacher added\nsupport for merging.\n\n\n\nGNU                                                                                         PATCH(1)\n\n"
        }
    ],
    "structuredContent": {
        "command": "patch",
        "section": "1",
        "mode": "man",
        "summary": "patch - apply a diff file to an original",
        "synopsis": "patch [options] [originalfile [patchfile]]\nbut usually just\npatch -pnum <patchfile",
        "tldr_summary": "Patch a file (or files) with a diff file.",
        "tldr_examples": [
            {
                "description": "Apply a patch using a diff file (filenames must be included in the diff file)",
                "command": "patch < {{patch.diff}}"
            },
            {
                "description": "Apply a patch to a specific file",
                "command": "patch < {{patch.diff}} {{path/to/file}}"
            },
            {
                "description": "Patch a file writing the result to a different file",
                "command": "patch < {{patch.diff}} {{path/to/input_file}} {{-o|--output}} {{path/to/output_file}}"
            },
            {
                "description": "Apply a patch to the current directory",
                "command": "patch < {{patch.diff}} {{-p|--strip}} 1"
            },
            {
                "description": "Apply the reverse of a patch",
                "command": "patch < {{patch.diff}} {{-R|--reverse}}"
            }
        ],
        "tldr_source": "official",
        "flags": [
            {
                "flag": "-b",
                "long": "--backup",
                "arg": null,
                "description": "Make backup files. That is, when patching a file, rename or copy the original instead of removing it. See the -V or --version-control option for details about how backup file names are determined."
            },
            {
                "flag": "",
                "long": "--backup-if-mismatch",
                "arg": null,
                "description": "Back up a file if the patch does not match the file exactly and if backups are not other‐ wise requested. This is the default unless patch is conforming to POSIX."
            },
            {
                "flag": "",
                "long": "--no-backup-if-mismatch",
                "arg": null,
                "description": "Do not back up a file if the patch does not match the file exactly and if backups are not otherwise requested. This is the default if patch is conforming to POSIX."
            },
            {
                "flag": "-B",
                "long": null,
                "arg": null,
                "description": "Use the simple method to determine backup file names (see the -V method or --version-con‐‐ trol method option), and append pref to a file name when generating its backup file name. For example, with -B /junk/ the simple backup file name for src/patch/util.c is /junk/src/patch/util.c."
            },
            {
                "flag": "",
                "long": "--binary",
                "arg": null,
                "description": "Write all files in binary mode, except for standard output and /dev/tty. When reading, disable the heuristic for transforming CRLF line endings into LF line endings. This op‐ tion is needed on POSIX systems when applying patches generated on non-POSIX systems to non-POSIX files. (On POSIX systems, file reads and writes never transform line endings. On Windows, reads and writes do transform line endings by default, and patches should be generated by diff --binary when line endings are significant.)"
            },
            {
                "flag": "-c",
                "long": "--context",
                "arg": null,
                "description": "Interpret the patch file as a ordinary context diff."
            },
            {
                "flag": "-d",
                "long": null,
                "arg": null,
                "description": "Change to the directory dir immediately, before doing anything else."
            },
            {
                "flag": "-D",
                "long": null,
                "arg": null,
                "description": "Use the #ifdef ... #endif construct to mark changes, with define as the differentiating symbol."
            },
            {
                "flag": "",
                "long": "--dry-run",
                "arg": null,
                "description": "Print the results of applying the patches without actually changing any files."
            },
            {
                "flag": "-e",
                "long": "--ed",
                "arg": null,
                "description": "Interpret the patch file as an ed script."
            },
            {
                "flag": "-E",
                "long": "--remove-empty-files",
                "arg": null,
                "description": "Remove output files that are empty after the patches have been applied. Normally this op‐ tion is unnecessary, since patch can examine the time stamps on the header to determine whether a file should exist after patching. However, if the input is not a context diff or if patch is conforming to POSIX, patch does not remove empty patched files unless this option is given. When patch removes a file, it also attempts to remove any empty ancestor directories."
            },
            {
                "flag": "-f",
                "long": "--force",
                "arg": null,
                "description": "Assume that the user knows exactly what he or she is doing, and do not ask any questions. Skip patches whose headers do not say which file is to be patched; patch files even though they have the wrong version for the Prereq: line in the patch; and assume that patches are not reversed even if they look like they are. This option does not suppress commentary; use -s for that."
            },
            {
                "flag": "-F",
                "long": null,
                "arg": null,
                "description": "Set the maximum fuzz factor. This option only applies to diffs that have context, and causes patch to ignore up to that many lines of context in looking for places to install a hunk. Note that a larger fuzz factor increases the odds of a faulty patch. The default fuzz factor is 2. A fuzz factor greater than or equal to the number of lines of context in the context diff, ordinarily 3, ignores all context."
            },
            {
                "flag": "-g",
                "long": null,
                "arg": null,
                "description": "This option controls patch's actions when a file is under RCS or SCCS control, and does not exist or is read-only and matches the default version, or when a file is under ClearCase or Perforce control and does not exist. If num is positive, patch gets (or checks out) the file from the revision control system; if zero, patch ignores RCS, ClearCase, Perforce, and SCCS and does not get the file; and if negative, patch asks the user whether to get the file. The default value of this option is given by the value of the PATCHGET environment variable if it is set; if not, the default value is zero."
            },
            {
                "flag": "",
                "long": "--help",
                "arg": null,
                "description": "Print a summary of options and exit."
            },
            {
                "flag": "-i",
                "long": null,
                "arg": null,
                "description": "Read the patch from patchfile. If patchfile is -, read from standard input, the default."
            },
            {
                "flag": "-l",
                "long": "--ignore-whitespace",
                "arg": null,
                "description": "Match patterns loosely, in case tabs or spaces have been munged in your files. Any se‐ quence of one or more blanks in the patch file matches any sequence in 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. --merge or --merge=merge or --merge=diff3 Merge a patch file into the original files similar to diff3(1) or merge(1). If a conflict is found, patch outputs a warning and brackets the conflict with <<<<<<< and >>>>>>> lines. A typical conflict will look like this: <<<<<<< lines from the original file ||||||| original lines from the patch ======= new lines from the patch >>>>>>> The optional argument of --merge determines the output format for conflicts: the diff3 format shows the ||||||| section with the original lines from the patch; in the merge for‐ mat, this section is missing. The merge format is the default. This option implies --forward and does not take the --fuzz=num option into account."
            },
            {
                "flag": "-n",
                "long": "--normal",
                "arg": null,
                "description": "Interpret the patch file as a normal diff."
            },
            {
                "flag": "-N",
                "long": "--forward",
                "arg": null,
                "description": "When a patch does not apply, patch usually checks if the patch looks like it has been ap‐ plied already by trying to reverse-apply the first hunk. The --forward option prevents that. See also -R."
            },
            {
                "flag": "-o",
                "long": null,
                "arg": null,
                "description": "Send output to outfile instead of patching files in place. Do not use this option if out‐ file is one of the files to be patched. When outfile is -, send output to standard out‐ put, and send any messages that would usually go to standard output to standard error."
            },
            {
                "flag": "-p",
                "long": null,
                "arg": null,
                "description": "Strip the smallest prefix containing num leading 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 case you keep your files in a different directory than the person who sent out the patch. For example, sup‐ posing the file name in the patch file was /u/howard/src/blurfl/blurfl.c setting -p0 gives the entire file name unmodified, -p1 gives u/howard/src/blurfl/blurfl.c without the leading slash, -p4 gives blurfl/blurfl.c and not specifying -p at all just gives you blurfl.c. Whatever you end up with is looked for either in the current directory, or the directory specified by the -d option."
            },
            {
                "flag": "",
                "long": "--posix",
                "arg": null,
                "description": "Conform more strictly to the POSIX standard, as follows. •• Take the first existing file from the list (old, new, index) when intuiting file names from diff headers. •• Do not remove files that are empty after patching. •• Do not ask whether to get files from RCS, ClearCase, Perforce, or SCCS. •• Require that all options precede the files in the command line. •• Do not backup files when there is a mismatch. --quoting-style=word Use style word to quote output names. The word should be one of the following: literal Output names as-is. shell Quote names for the shell if they contain shell metacharacters or would cause am‐ biguous output. shell-always Quote names for the shell, even if they would normally not require quoting. c Quote names as for a C language string. escape Quote as with c except omit the surrounding double-quote characters. You can specify the default value of the --quoting-style option with the environment vari‐ able QUOTINGSTYLE. If that environment variable is not set, the default value is shell."
            },
            {
                "flag": "-r",
                "long": null,
                "arg": null,
                "description": "Put rejects into rejectfile instead of the default .rej file. When rejectfile is -, dis‐ card rejects."
            },
            {
                "flag": "-R",
                "long": "--reverse",
                "arg": null,
                "description": "Assume that this patch was created with the old and new files swapped. (Yes, I'm afraid that does happen occasionally, human nature being what it is.) patch attempts to swap each hunk around before applying it. Rejects come out in the swapped format. The -R op‐ tion does not work with ed diff scripts because there is too little information to recon‐ struct the reverse operation. If the first hunk of a patch fails, patch reverses the hunk to see if it can be applied that way. If it can, you are asked if you want to have the -R option 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 diff and 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 matches anywhere. Luckily, most patches add or change lines rather than delete them, so most re‐ versed normal diffs begin with a delete, which fails, triggering the heuristic.) --read-only=behavior Behave as requested when trying to modify a read-only file: ignore the potential problem, warn about it (the default), or fail. --reject-format=format Produce reject files in the specified format (either context or unified). Without this option, rejected hunks come out in unified diff format if the input patch was of that for‐ mat, otherwise in ordinary context diff form."
            },
            {
                "flag": "-s",
                "long": "--quiet",
                "arg": null,
                "description": "Work silently, unless an error occurs."
            },
            {
                "flag": "",
                "long": "--follow-symlinks",
                "arg": null,
                "description": "When looking for input files, follow symbolic links. Replaces the symbolic links, instead of modifying the files the symbolic links point to. Git-style patches to symbolic links will no longer apply. This option exists for backwards compatibility with previous ver‐ sions of patch; its use is discouraged."
            },
            {
                "flag": "-t",
                "long": "--batch",
                "arg": null,
                "description": "Suppress questions like -f, but make some different assumptions: skip patches whose head‐ ers do not contain file names (the same as -f); skip patches for which the file has the wrong version for the Prereq: line in the patch; and assume that patches are reversed if they look like they are."
            },
            {
                "flag": "-T",
                "long": "--set-time",
                "arg": null,
                "description": "Set the modification and access times of patched files from time stamps given in context diff headers. Unless specified in the time stamps, assume that the context diff headers use local time. Use of this option with time stamps that do not include time zones is not recommended, be‐ cause patches using local time cannot easily be used by people in other time zones, and because local time stamps are ambiguous when local clocks move backwards during daylight- saving time adjustments. Make sure that time stamps include time zones, or generate patches with UTC and use the -Z or --set-utc option instead."
            },
            {
                "flag": "-u",
                "long": "--unified",
                "arg": null,
                "description": "Interpret the patch file as a unified context diff."
            },
            {
                "flag": "-v",
                "long": "--version",
                "arg": null,
                "description": "Print out patch's revision header and patch level, and exit."
            },
            {
                "flag": "-V",
                "long": null,
                "arg": null,
                "description": "Use method to determine backup file names. The method can also be given by the PATCHVER‐‐ SIONCONTROL (or, if that's not set, the VERSIONCONTROL) 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. The value of method is like the GNU Emacs `version-control' variable; patch also recog‐ nizes synonyms that are more descriptive. The valid values for method are (unique abbre‐ viations are accepted): existing or nil Make numbered backups of files that already have them, otherwise simple backups. This is the default. numbered or t Make numbered backups. The numbered backup file name for F is F.~N~ where N is the version number. simple or never Make simple backups. The -B or --prefix, -Y or --basename-prefix, and -z or --suffix options 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 SIMPLEBACKUPSUFFIX environment variable if set, and is .orig otherwise. With numbered or simple backups, if the backup file name is too long, the backup suffix ~ is used instead; if even appending ~ would make the name too long, then ~ replaces the last character of the file name."
            },
            {
                "flag": "",
                "long": "--verbose",
                "arg": null,
                "description": "Output extra information about the work being done."
            },
            {
                "flag": "-x",
                "long": null,
                "arg": null,
                "description": "Set internal debugging flags of interest only to patch patchers."
            },
            {
                "flag": "-Y",
                "long": null,
                "arg": null,
                "description": "Use the simple method to determine backup file names (see the -V method or --version-con‐‐ trol method option), and prefix pref to the basename of a file name when generating its backup file name. For example, with -Y .del/ the simple backup file name for src/patch/util.c is src/patch/.del/util.c."
            },
            {
                "flag": "-z",
                "long": null,
                "arg": null,
                "description": "Use the simple method to determine backup file names (see the -V method or --version-con‐‐ trol method option), and use suffix as the suffix. For example, with -z - the backup file name for src/patch/util.c is src/patch/util.c-."
            },
            {
                "flag": "-Z",
                "long": "--set-utc",
                "arg": null,
                "description": "Set the modification and access times of patched files from time stamps given in context diff headers. Unless specified in the time stamps, assume that the context diff headers use Coordinated Universal Time (UTC, often known as GMT). Also see the -T or --set-time option. The -Z or --set-utc and -T or --set-time options normally refrain from setting a file's time if the file's original time does not match the time given in the patch header, or if its contents do not match the patch exactly. However, if the -f or --force option is given, the file time is set regardless. Due to the limitations of diff output format, these options cannot update the times of files whose contents have not changed. Also, if you use these options, you should remove (e.g. with make clean) all files that depend on the patched files, so that later invoca‐ tions of make do not get confused by the patched files' times."
            }
        ],
        "examples": [],
        "see_also": [
            {
                "name": "diff",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/diff/1/json"
            },
            {
                "name": "ed",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/ed/1/json"
            },
            {
                "name": "merge",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/merge/1/json"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 6,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 8,
                "subsections": [
                    {
                        "name": "-c --context -e --ed -n --normal -u --unified",
                        "lines": 96,
                        "flag": "-u",
                        "long": "--unified"
                    }
                ]
            },
            {
                "name": "OPTIONS",
                "lines": 1,
                "subsections": [
                    {
                        "name": "-b --backup",
                        "lines": 4,
                        "flag": "-b",
                        "long": "--backup"
                    },
                    {
                        "name": "--backup-if-mismatch",
                        "lines": 3,
                        "long": "--backup-if-mismatch"
                    },
                    {
                        "name": "--no-backup-if-mismatch",
                        "lines": 3,
                        "long": "--no-backup-if-mismatch"
                    },
                    {
                        "name": "-B --prefix=",
                        "lines": 5,
                        "flag": "-B"
                    },
                    {
                        "name": "--binary",
                        "lines": 7,
                        "long": "--binary"
                    },
                    {
                        "name": "-c --context",
                        "lines": 2,
                        "flag": "-c",
                        "long": "--context"
                    },
                    {
                        "name": "-d --directory=",
                        "lines": 2,
                        "flag": "-d"
                    },
                    {
                        "name": "-D --ifdef=",
                        "lines": 3,
                        "flag": "-D"
                    },
                    {
                        "name": "--dry-run",
                        "lines": 2,
                        "long": "--dry-run"
                    },
                    {
                        "name": "-e --ed",
                        "lines": 2,
                        "flag": "-e",
                        "long": "--ed"
                    },
                    {
                        "name": "-E --remove-empty-files",
                        "lines": 7,
                        "flag": "-E",
                        "long": "--remove-empty-files"
                    },
                    {
                        "name": "-f --force",
                        "lines": 6,
                        "flag": "-f",
                        "long": "--force"
                    },
                    {
                        "name": "-F --fuzz=",
                        "lines": 6,
                        "flag": "-F"
                    },
                    {
                        "name": "-g --get=",
                        "lines": 8,
                        "flag": "-g"
                    },
                    {
                        "name": "--help",
                        "lines": 2,
                        "long": "--help"
                    },
                    {
                        "name": "-i --input=",
                        "lines": 2,
                        "flag": "-i"
                    },
                    {
                        "name": "-l --ignore-whitespace",
                        "lines": 24,
                        "flag": "-l",
                        "long": "--ignore-whitespace"
                    },
                    {
                        "name": "-n --normal",
                        "lines": 2,
                        "flag": "-n",
                        "long": "--normal"
                    },
                    {
                        "name": "-N --forward",
                        "lines": 4,
                        "flag": "-N",
                        "long": "--forward"
                    },
                    {
                        "name": "-o --output=",
                        "lines": 4,
                        "flag": "-o"
                    },
                    {
                        "name": "-p --strip=",
                        "lines": 19,
                        "flag": "-p"
                    },
                    {
                        "name": "--posix",
                        "lines": 32,
                        "long": "--posix"
                    },
                    {
                        "name": "-r --reject-file=",
                        "lines": 3,
                        "flag": "-r"
                    },
                    {
                        "name": "-R --reverse",
                        "lines": 23,
                        "flag": "-R",
                        "long": "--reverse"
                    },
                    {
                        "name": "-s --silent --quiet",
                        "lines": 2,
                        "flag": "-s",
                        "long": "--quiet"
                    },
                    {
                        "name": "--follow-symlinks",
                        "lines": 5,
                        "long": "--follow-symlinks"
                    },
                    {
                        "name": "-t --batch",
                        "lines": 5,
                        "flag": "-t",
                        "long": "--batch"
                    },
                    {
                        "name": "-T --set-time",
                        "lines": 10,
                        "flag": "-T",
                        "long": "--set-time"
                    },
                    {
                        "name": "-u --unified",
                        "lines": 2,
                        "flag": "-u",
                        "long": "--unified"
                    },
                    {
                        "name": "-v --version",
                        "lines": 2,
                        "flag": "-v",
                        "long": "--version"
                    },
                    {
                        "name": "-V --version-control=",
                        "lines": 27,
                        "flag": "-V"
                    },
                    {
                        "name": "--verbose",
                        "lines": 2,
                        "long": "--verbose"
                    },
                    {
                        "name": "-x --debug=",
                        "lines": 2,
                        "flag": "-x"
                    },
                    {
                        "name": "-Y --basename-prefix=",
                        "lines": 5,
                        "flag": "-Y"
                    },
                    {
                        "name": "-z --suffix=",
                        "lines": 4,
                        "flag": "-z"
                    },
                    {
                        "name": "-Z --set-utc",
                        "lines": 15,
                        "flag": "-Z",
                        "long": "--set-utc"
                    }
                ]
            },
            {
                "name": "ENVIRONMENT",
                "lines": 22,
                "subsections": []
            },
            {
                "name": "FILES",
                "lines": 3,
                "subsections": [
                    {
                        "name": "/dev/tty",
                        "lines": 2
                    }
                ]
            },
            {
                "name": "SEE ALSO",
                "lines": 5,
                "subsections": []
            },
            {
                "name": "NOTES FOR PATCH SENDERS",
                "lines": 57,
                "subsections": []
            },
            {
                "name": "DIAGNOSTICS",
                "lines": 11,
                "subsections": []
            },
            {
                "name": "CAVEATS",
                "lines": 16,
                "subsections": []
            },
            {
                "name": "COMPATIBILITY ISSUES",
                "lines": 57,
                "subsections": []
            },
            {
                "name": "BUGS",
                "lines": 13,
                "subsections": []
            },
            {
                "name": "COPYING",
                "lines": 16,
                "subsections": []
            },
            {
                "name": "AUTHORS",
                "lines": 9,
                "subsections": []
            }
        ]
    }
}