How to create a patch for a Drupal module
Short walkthrough on how to create a patch for a Drupal module using Git and Giggle.
First make sure your issue is not already reported by someone else in the issue queue for the module. Also check out the latest dev version of the module, is the issue resolved there? If all statements above equals FALSE lets make a patch:
Start the terminal and download the module to your test environent with Drush. drush dl [module-name]
Enter the directory and initialize an empty repository cd [module-name] git init
Add the files to you repository git add *
Commit the files to the repository git commit -m 'Initial commit'
Make your awesome changes to the file you want to change.
Commit your changes to git git commit -m 'Description what you've changed'
Start Giggle, at the bottom right of the application window you will find a button named Details, click this then click on your initial commit and copy the SHA-tag (looks something like this: 325449643c76dbeade12033d8304f447e53742d9) Click on your next commit and copy the SHA-tag from that.
Enter the terminal and execute the command below
git diff --no-prefix [original-SHA] [patched-SHA] > my-patchfile.patch
- File an issue at the project page for module you have patched and mark the issue as needs review. Make sure you select the correct version for the module. If available, post a screenshot of the problem and the solution.