2015-10-22 08:31:52 +01:00
|
|
|
# patch
|
2014-10-25 12:20:07 +01:00
|
|
|
|
2014-10-28 19:27:51 +00:00
|
|
|
> Patch a file (or files) with a diff file.
|
2019-06-06 02:18:02 +01:00
|
|
|
> Note that diff files should be generated by the `diff` command.
|
2014-10-25 12:20:07 +01:00
|
|
|
|
2019-06-06 02:18:02 +01:00
|
|
|
- Apply a patch using a diff file (filenames must be included in the diff file):
|
2014-10-25 12:20:07 +01:00
|
|
|
|
2019-06-06 02:18:02 +01:00
|
|
|
`patch < {{patch.diff}}`
|
2014-10-25 12:20:07 +01:00
|
|
|
|
2019-06-06 02:18:02 +01:00
|
|
|
- Apply a patch to a specific file:
|
2014-10-25 12:20:07 +01:00
|
|
|
|
2019-06-06 02:18:02 +01:00
|
|
|
`patch {{path/to/file}} < {{patch.diff}}`
|
|
|
|
|
|
|
|
- Patch a file writing the result to a different file:
|
|
|
|
|
|
|
|
`patch {{path/to/input_file}} -o {{path/to/output_file}} < {{patch.diff}}`
|
|
|
|
|
|
|
|
- Apply a patch to the current directory:
|
|
|
|
|
|
|
|
`patch -p1 < {{patch.diff}}`
|
2014-10-25 12:20:07 +01:00
|
|
|
|
2016-01-07 17:31:27 +00:00
|
|
|
- Apply the reverse of a patch:
|
2014-10-25 12:20:07 +01:00
|
|
|
|
2019-06-06 02:18:02 +01:00
|
|
|
`patch -R < {{patch.diff}}`
|