How to make patch files to contribute to contributed modules
Key words and phrases
create patches for drupal modules run diff drupal make a patchTags
Description
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
Update: see recommended patch naming conventions!

For going the other way, see Agaric's how to apply a patch to a Drupal module.