Creating and Applying Patches

(Submitted Mon, 2006-09-18 22:27)

I regularly find myself digging up the proper nodes to explain to someone on the forums how to apply a patch either from a shell command line or locally on a windows machine.

I also find myself always needing to dig up the information on the proper command line syntax for generating a patch for submission.

So here's the scoop, so I don't have to do all that oh-so-complicated searching everytime ;)

Creating a patch:
diff -uF^function old.module new.module > file.patch

More info available at http://drupal.org/diffanpatch

Applying a patch from shell:
patch old.module < file.patch
(I find that the -p option is rarely needed)

Applying a patch on a local windows box to upload via FTP:
Discussion of various means here

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <blockquote>
  • Lines and paragraphs break automatically.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.

Hosted By Dreamhost.com