How to make patch files to contribute to contributed modules
These instructions assume a GNU-Linux, Mac OS X, or other UNIX-y computing environment.
Follow these instructions for using CVS:
http://drupal.org/patch/create
However, if you are making a patch for a contributed module rather than Drupal core, going to the Drupal root directory doesn't make sense.
For a change to a single file (not adding or removing a file), you can just make a copy of the original file, call your new file _original and list the file you change (the one without a rename in this case) second in the diff command.
And create the actual patch from within the module directory:
diff -up token_node_original.inc token_node.inc > token_5_reroll.patch
For a patch that affects multiple files:
First make sure you have an unblemished copy to compare to:
cd ~
ben@ebony-ubuntu:~$ drush dl hierarchical_select-5.x
Project hierarchical_select (5.x-3.0-rc7) downloaded to /home/ben/.
Now go back to the directory where you edited the project, for instance cd /path/to/project/sites/all/modules/hierarchical_select
and:
diff -urp . /home/ben/hierarchical_select > hierarchical_select_fix_plus_gmix_tweak.patch
Note both of the above would be easier with cvs diff (no name or keep or fetch the original files, because it will compare directly to the central repository) if you have the foresight to check the project out of CVS before you begin working.
See also: recommended patch naming conventions.
Comments
For going the other way, see
For going the other way, see Agaric's how to apply a patch to a Drupal module.
Post new comment