Often programmers that haven’t worked with patches before find it intimidating. Patches are actually very simple to deal with. Here is how.

Creating Patches

diff -u oldfile newfile > filename.patch

or

diff -urN /olddir /newdir > filename.patch

or

diff -urN -X excludes /olddir /newdir > filename.patch

diff options:
Output (default 2) lines of unified context.
Recursively compare any subdirectories found.
Treat absent files as empty.
Exclude files that match any pattern in .

Note: The options can be replaced with to create a context format diff file with a setting of two lines.

Applying Patches

gzip -cd patch.gz | patch -p0

or

bzip2 -dc patch.bz2 | patch -p0

or

patch -p0 < filename.patch

patch options:
Strip leading components from file names.