Applying a patch to a Drupal module

Applying a patch to a Drupal module

I will quickly show you how to apply a patch to a Drupal module. Following works for all versions of Drupal.

1. First download a patch and save it to your local hard drive (in my example I saved it under C:\wamp\www).

2. In your command line enter following (replace audiofield with the name of the module you wish to patch):

git clone --recursive --branch master http://git.drupal.org/project/audiofield.git 

cd audiofield/

git branch -a git checkout 6.x-1.x

git status git apply C:\wamp\www\mypatch.patch

To use different version of Drupal module change: git checkout 6.x-1.x into git checkout 7.x-1.x or whatever version of the module you wish to use.