CmdID

CmdID / Commands

patch

Apply a unified diff to one or more files. toybox

On Linux

Opens CmdID with your command. It is read in your browser and sent nowhere.

Linux

from the toybox, 0BSD

Apply a unified diff to one or more files. Only handles "unified" diff format (-u is assumed and ignored). Only modifies files when all hunks to that file apply. Prints failed hunks to stderr, and exits with nonzero status if any hunks fail. Files compared against /dev/null (or with a date <= the unix epoch) are created/deleted as appropriate. Default -F value is the number of leading/trailing context lines minus one (usually 2).

patch [-Rlsuv] [-d DIR] [-i FILE] [-p DEPTH] [-F FUZZ] [--dry-run] [FILE [PATCH]]
-d DIRModify files in DIR
-F FUZZFuzz factor (number of non-matching context lines allowed per hunk)
-i FILEInput patch from FILE (default=stdin)
-lLoose match (ignore whitespace)
-p DEPTHNumber of '/' to strip from start of file paths (default=all)
-RReverse patch
-sSilent except for errors
-vVerbose (-vv to see decisions)
--dry-runDon't change files, just confirm patch applies

Several platforms

from tldr-pages, CC BY 4.0

Patch a file (or files) with a diff file. Note that diff files should be generated by the diff command.

Apply a patch using a diff file (filenames must be included in the diff file)

patch --input patch.diffIdentify

Apply a patch to a specific file

patch --input patch.diff path/to/fileIdentify

Patch a file writing the result to a different file

patch --input patch.diff path/to/input_file --output path/to/output_fileIdentify

Apply a patch to the current directory

patch --input patch.diff --strip 1Identify

Apply the reverse of a patch

patch --input patch.diff --reverseIdentify