Skip to content

Latest commit

 

History

History
45 lines (36 loc) · 807 Bytes

patch.md

File metadata and controls

45 lines (36 loc) · 807 Bytes

Hunks are read from STDIN or a patch file

Patch one or many files

The filename can be omitted if it can be deduced from within the hunks.
It must be omitted when patching multiple files.

These 3 commands are equivalent:

patch [pf.conf] -i pf.patch # --input
patch [pf.conf] < pf.patch
patch [pf.conf]
   paste on STDIN
^d

Patch a single file

patch pf.conf pf.patch

Paths in hunks must correspond to real files

--- /home/user/project.pl
+++ /home/user/project.pl
# if user is unknown locally, remove /home/user by stripping 3 leading /s
patch -p3 < project.patch

NB: relative paths in hunks need -p0

Create a patch

diff -u orig new > orig.patch
        git diff > orig.patch
    svn di -x -u > orig.patch