Last updated December 22, 2017

Patches are text files that end in a .patch extension. They are structured files that consist of a list of differences between one set of files and another. They are used to describe the changes between a before (clean) and after (modified) state of the code in a module, a theme, or Drupal core. The Drupal community uses patches in order to share ongoing work and solutions to issues. You'll encounter them frequently in the issue queue as the solution to a known problem with a module or theme. As a Drupal developer you'll use patches to contribute your own work back to the project when you solve bugs or add new features.

When working with Drupal we recommend using Git to manage the application and creation of patches. However, the standard Unix patch and diff utilities will work just fine if you're more comfortable with those.

Example tasks

  • Apply a recommended patch from an issue on in order to fix a bug in a module or theme
  • Download and apply a patch for Drupal core to review/test a proposed new feature
  • Create a new patch based on your modifications to a module that you can upload to the issue queue to share with others


Drupal developers have been using patches to share code changes since the beginning. So the available resources, even older ones, are still accurate. It's likely that at some point in the future this will change to be a more Git-centric pull-request based workflow. But when that happens it'll be big news.

Drupalize.Me resources

More Guides

We have guides on many Drupal skills and topics.

Explore guides

External resources

  • What is a patch? (
    • Learn more about the .patch file format and what each of the different lines in a patch file means.
  • cweagans/composer-patches (
    • If you use Composer to manage your codebase cweagans/composer-patches is the recommended way to apply patches. We like this approach because it also means you've got a record of which patches you've applied so that when it comes time to update a module in the future you don't forget to reapply them.