Creating a Patch

So, you have moved on from just using Drupal and now you want to create a patch. For me, this started with making a patch for a contributed module and all I had to do was upload the patch to the issue.

The patch files are best created with git and this can be done on Linux or with Cygwin on Windows. The instructions are available at Patches | and are easy enough to follow, however it is also worth reading Advanced patch contributor guide | My basic example is below:

Start by launching a Cygwin terminal session
cd /cygwin/c/sources/drupal

git clone --branch [base_branch][module_name].git
cd [module_name]

# create a branch
git branch [module_id]-[fix_description]
git checkout [module_id]-[fix_description]

# make changes

# see which files changed
git status

# see exact changes
git diff

git commit
# if this complains run following two lines
# see your profile for this, under "Edit", "Git Access" git config --global "[your_email]"
git config --global "[your_name]"

# do actual commit with a message
git commit -a -m "[fix description]"

git diff [base_branch] > [module_name]-[fix_description]-[module_id]-[comment_no].patch