2015-10-22 15:31:52 +08:00
|
|
|
# patch
|
2014-10-25 13:20:07 +02:00
|
|
|
|
2014-10-28 20:27:51 +01:00
|
|
|
> Patch a file (or files) with a diff file.
|
2019-06-06 03:18:02 +02:00
|
|
|
> Note that diff files should be generated by the `diff` command.
|
2014-10-25 13:20:07 +02:00
|
|
|
|
2019-06-06 03:18:02 +02:00
|
|
|
- Apply a patch using a diff file (filenames must be included in the diff file):
|
2014-10-25 13:20:07 +02:00
|
|
|
|
2019-06-06 03:18:02 +02:00
|
|
|
`patch < {{patch.diff}}`
|
2014-10-25 13:20:07 +02:00
|
|
|
|
2019-06-06 03:18:02 +02:00
|
|
|
- Apply a patch to a specific file:
|
2014-10-25 13:20:07 +02:00
|
|
|
|
2019-06-06 03:18:02 +02: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 13:20:07 +02:00
|
|
|
|
2016-01-07 18:31:27 +01:00
|
|
|
- Apply the reverse of a patch:
|
2014-10-25 13:20:07 +02:00
|
|
|
|
2019-06-06 03:18:02 +02:00
|
|
|
`patch -R < {{patch.diff}}`
|