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.
- Apply a recommended patch from an issue on Drupal.org 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 Drupal.org 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.
- Applying and Creating Patches with Git
- Walks through the process of downloading a patch from Drupal.org and applying it to Drupal 7 core using Git. These same steps will also work for applying patches to Drupal 8 and contributed modules or themes.