Recipe 91: Creating a Patch
Note
Ingredients
Diff utility
Regardless of your Drupal programming skill level, you may submit patches to the Drupal issue queue. Module maintainers and users will appreciate patches ranging from spelling corrections, to more complex bug fixes and new features. Patches may be created with the diff command or the CVS diff
command. The example below uses diff.
Backup the file intended for editing.
cp views_ui.module views_ui.module.backup
Edit the file with the editor of your choice.
vim views_ui.module
Run the
diff
command to create a patch. Notice that the command uses the-u
and-p
switches and compares the original file (first) to the edited file (second). Thediff
is then redirected to an output file, usually named with a.patch
extension.diff -up views_ui.module.backup views_ui.module > views_ui.module.patch
Note
Patch command switches
The
-
u
switch in the patch command stands for unified contextdiff
, which is the desired format for Drupal patches. In addition...