Git <3 Drupal

Receiving Git Attribution for Your Patches

Filed under:

If you contribute patches to the Drupal issue queues, you often spend a lot of time and hard work getting that patch through the review process. Even though we do it for the good of the community, once it is all said and done, it's nice to get a little acknowledgement. While there is a page for module maintainers on how to properly attribute contributions to users, not all maintainers know about that, and it can often mean they have to spend a little extra time figuring out what your git email address is. But there is a quick way for us as patch contributors to make that easier for them.

Once you clone a contrib module repo, you should set the and for that repo and then use git format-patch when creating your patch.

git config --local jojonaloha
git config --local

If you want to use these by default you can use the --global flag instead.

Date posted: April 3, 2013


See This handy module makes it easy to create and apply patches. It will automatically use git format-patch when creating patches, and for maintainers, drush iq-apply-patch will automatically provide commit credit to the patch submitter, even if format-patch was not used to create the patch. Give it a try.

It's probably also worth mentioning that Dreditor creates a "Create commit message" feature in the issue queue to craft an appropriately attributed Git commit.

some maintainers have been kind to attribute my patches to me (both of them?) - these instructions make that easier, thanks Jonathan!

Just a heads up that it can be helpful to mention in the queue when you've used the format-patch command instead of standard diff.

I started using format-patch soon after the switch to git and people didn't realize that it separates your work into discrete commits within the file. While this separation is cool (and allows original authors of re-rolled patches to retain their credit too!), if someone wants to visually review the patch, they may consider it incomplete unless you instruct them to actually apply it then look at the full diff.

While format-patch output with multiple patches is sometimes used in the issue queue, it is more common for folks to go with the easier-to-read single-patch attachments. You can still create this kind of patch, with all changes rolled into a single diff, with git format-patch; however, doing so requires that you create a new branch first, and then use git merge --squash to merge and combine the commits together. If you use drush iq-diff, it will automatically squash your commit before creating it with format-patch, so you will get an easy-to-read patch file that also contains commit credit. Even better, if you use the new drush iq-submit command, it will also create an interdiff for you.

For a description of the Drush IQ workflow, see:…

Good info on how to make it work... but finding notes on how to properly use git format-patch is proving crappy!

Add new comment

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <cpp>, <java>, <php>. The supported tag styles are: <foo>, [foo].
  • Web page addresses and email addresses turn into links automatically.
  • Lines and paragraphs break automatically.

Metal Toad is an Advanced AWS Consulting Partner. Learn more about our AWS Managed Services

Schedule a Free Consultation

Speak with our team to understand how Metal Toad can help you drive innovation, growth, and success.