Rushland Logo

Creating and applying patches

This quick tutorial is based on information gleaned from the internet. I have compiled it into this very simple quick tutorial into how to create and apply patches.

Creating a patch

Creating a patch is quite simple. You should have two copies of the file you're creating the patch from. The first is the original file before your changes. I think it's best to call these files file.orig (source). The second file is your file with the changes (the destination). We're going to use a program called diff to create a unified patch:

diff -u file.orig file > file.patch

Simple as that

Applying a patch

Applying a patch is just as easy, all we have to do is apply the patch file we've created.

patch -p0 < file.patch

Hey presto, we're done here.