tldr/pages/common/patch.md

25 lines
574 B
Markdown
Raw Normal View History

2015-10-22 08:31:52 +01:00
# patch
2014-10-25 12:20:07 +01:00
> Patch a file (or files) with a diff file.
> Note that diff files should be generated by the `diff` command.
2014-10-25 12:20:07 +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
`patch < {{patch.diff}}`
2014-10-25 12:20:07 +01:00
- Apply a patch to a specific file:
2014-10-25 12:20:07 +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
- Apply the reverse of a patch:
2014-10-25 12:20:07 +01:00
`patch -R < {{patch.diff}}`