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. In addition to a patch workflow, you will now notice the option to create an issue fork or merge request through GitLab. This GitLab integration with Drupal.org works alongside patches and may eventually replace a patch workflow. See Creating issue forks and merge requests for instructions.