Applying patches from the command line

Applying patches is easier than you think! Start by making sure that you have a safe place to apply your patch. This would be a 'dev' copy of the website, either running locally on your own computer, or in a development environment on the same server (or one that's identical) to your live site. *Never* apply patches directly to your live website!!!

For the purposes of the example below, we'll pretend we are patching the panels module.

1) Start from the root of your Drupal site.


2) Change Directories into the folder for the panels module

[.../drupal-7]  cd sites/all/modules/contrib/panels

3) Download the patch file from

[.../drupal-7/sites/all/modules/contrib/panels]  wget

4) apply the patch

[.../drupal-7/sites/all/modules/contrib/panels]  patch -p1 

If everything goes well, you'll see the files that are patched:

[.../drupal-7/sites/all/modules/contrib/panels]  patching file panels_mini/panels_mini.css
[.../drupal-7/sites/all/modules/contrib/panels]  patching file panels_mini/panels_mini.module

5) Clear your caches, and go test your new fix/feature!

© 2023 Jeneration Web Development