OnCallReadyStart learning

patch: apply a diff file to an original

patch [OPTION]... [ORIGFILE [PATCHFILE]]

Options you will use

-p N, --strip=N
Remove N leading path parts from the names in the diff: -p1 turns a/src/x.c into src/x.c (what git diffs need). Without -p only the base name is used.
-i FILE, --input=FILE
Read the patch from FILE instead of standard input.
--dry-run
Report what would happen ("checking file ...") and change nothing.
-R, --reverse
Apply the patch backwards: undo a patch that was applied.
-N, --forward
Skip a patch that looks already applied instead of asking.
-b, --backup
Keep the original as FILE.orig.
-F N, --fuzz=N
How many context lines a hunk may ignore at each end to still fit (default 2).
-d DIR, --directory=DIR
Change to DIR first.
-s, --silent
Print only errors.

Examples

$ patch -p1 --dry-run < fix.diff

check first

$ patch -p1 < fix.diff

apply a diff made with diff -ru a b or git

$ patch -R -p1 < fix.diff

undo it

Gotchas

Try patch in a real terminal Free, in your browser - a real Ubuntu terminal to try it in, with missions that check your work.