2025-03-14 21:59:59 -06:00
|
|
|
# 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:
|
|
|
|
|
|
2025-12-16 10:20:31 -07:00
|
|
|
`patch < {{patch.diff}} {{path/to/file}}`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
- Patch a file writing the result to a different file:
|
|
|
|
|
|
2025-12-16 10:20:31 -07:00
|
|
|
`patch < {{patch.diff}} {{path/to/input_file}} {{[-o|--output]}} {{path/to/output_file}}`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
- Apply a patch to the current directory:
|
|
|
|
|
|
2025-12-16 10:20:31 -07:00
|
|
|
`patch < {{patch.diff}} {{[-p|--strip]}} 1`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
- Apply the reverse of a patch:
|
|
|
|
|
|
2025-12-16 10:20:31 -07:00
|
|
|
`patch < {{patch.diff}} {{[-R|--reverse]}}`
|