snippetbashTip
patch — Patch a file (or files) with a diff file. Note that diff files should be generated by the `diff` com
Viewed 0 times
commandfilesclifilewithdiffpatch
Problem
How to use the
patch command: Patch a file (or files) with a diff file. Note that diff files should be generated by the diff command. More information: <https://manned.org/patch>.Solution
patch — Patch a file (or files) with a diff file. Note that diff files should be generated by the diff command. More information: <https://manned.org/patch>.Apply a patch using a diff file (filenames must be included in the diff file):
patch < {{patch.diff}}Apply a patch to a specific file:
patch < {{patch.diff}} {{path/to/file}}Patch a file writing the result to a different file:
patch < {{patch.diff}} {{path/to/input_file}} {{[-o|--output]}} {{path/to/output_file}}Apply a patch to the current directory:
patch < {{patch.diff}} {{[-p|--strip]}} 1Apply the reverse of a patch:
patch < {{patch.diff}} {{[-R|--reverse]}}Code Snippets
Apply a patch using a diff file (filenames must be included in the diff file)
patch < {{patch.diff}}Apply a patch to a specific file
patch < {{patch.diff}} {{path/to/file}}Patch a file writing the result to a different file
patch < {{patch.diff}} {{path/to/input_file}} {{[-o|--output]}} {{path/to/output_file}}Apply a patch to the current directory
patch < {{patch.diff}} {{[-p|--strip]}} 1Apply the reverse of a patch
patch < {{patch.diff}} {{[-R|--reverse]}}Context
tldr-pages: common/patch
Revisions (0)
No revisions yet.