Skip to main content

As a process I apply patches locally first, then using git upload the update(s) to a development site on the server.  Once the testing has been completed, the final step to apply the patch to the production site.  

Using Terminal or your preferred shell program, navigate to the correct directory.  Then run this command using the name of the patch file (example.patch):

patch < example.patch

However, if you are patching Drupal core then remember to patch from the root directory and use the -p0 to patch. This will stop patch from asking you which file you wish to patch:

patch -p0 < example.patch 

If your patch uses a & b directories in the patch, you can use the -p1 to get rid of the a & b directories.

patch -p1 < example.patch

Most of my patches are to core in making minor tweaks.