Error message

The spam filter installed on this site is currently unavailable. Per site policy, we are unable to accept new submissions until that problem is resolved. Please try resubmitting the form in a couple of minutes.

Drupal - How to Patch a Module

Category: 

This tutorial describes how to patch a module on your live Drupal site with the code changes you have made on your Drupal development site. If you already have a patch file that needs to be applied to a module, read this article instead: Apply a Patch to a Drupal Module

Otherwise, let us venture forth in quest of more libations!

Create the Patch

# cd ~
# diff -ruN /var/www/my_drupal_site/sites/all/modules/custom/my_module/ /var/www_dev/my_drupal_site/sites/all/modules/custom/my_module > my_module.patch

Backup Module Before Patching

# cp -r /var/www/my_drupal_site/sites/all/modules/custom/my_module my_module.backup

Try a Dry Run of the Patch

Now let's do a dry run of the patch on the live server to see if it looks OK before actually patching the module:

patch --dry-run --verbose -p0 < my_module.patch

If the dry run output looks OK, let's run it for real:

Patch the Module

patch -p0 < my_module.patch

Now get out there and patch some modules!

Here's another article I wrote about practically the same thing, sometimes I forget stuff, my brain drive only has so much space:

Create and Apply a Patch to a Drupal Module

Add new comment