Writing a patch on a sandbox/dev install using a git branch I'm working with a Sandbox/Dev hosted VM with Drupal 7 and Commons 3. I want to write and perhaps contribute a patch. Having the site under local version control with git, I create a new branch write and test the code. 

However, I'm at a loss how to create the patch file between the two branches (master and writing-patch). 

Do I switch back the master? How do I compare two branches and properly put that into a patch file with the intention of sharing with a module maintainer? I'd like to do this properly and put as little work on the maintainer as possible.
Go to the module you want to patch and do a:

git diff original_branch final_branch &gt; /path/to/file.patch


Test it by applying the patch to the initial module:

patch -p1 &lt; /path/to/file.patch


or

git apply --index /path/to/file.patch


More info:

http://linux.about.com/od/commands/l/blcmdl1_patch.htm

https://drupal.org/node/707484