When I run apply patches to contributed modules, I download the patch, put it in the modules folder, and then execute git apply patch patch_file_name from that folder.

I never ran a patch for Drupal core, though, and I believe it's a bit different.

How can I apply a patch to Drupal core, which could involve multiple Drupal core modules?

2 Answers 2


Drush make is a method to maintain patched releases of contrib and core. It is the only organized, non-custom, method I know of for patch management. The makefile is self-documenting. By "self-documenting", I mean that the makefile contains a list of modules, their versions, and URLs of applied patches.

Create a makefile of an existing Drupal site with:

drush generate-makefile mysite.make

Note, as far as I know drush generate-makefile will not detect applied patches. The example makefile demonstrates how to reference patches in your makefile.


You can use patch command (read here for more). For eg. put the patch file in the folder where the file is stored for which the patch was written, then apply the patch.

patch < file.patch

NOTE: for maintainability purposes, I follow these steps before and after the patch is successfully applied.

  • Make sure there is an issue in Drupal Core regarding the patch. If not then create one and upload the patch.
  • Download the patch from the issue. If you use patch naming guidelines or Dreditor for patch name suggestion, then the patch will also have issue id. Also you can keep track of the issue to check if a better solution is available or the issue is closed(fixed).
  • Make a folder in your Drupal installation inside sites folder or root folder and have a copy of the patch in there. This should be done so that if you update the Drupal Core, then your core changes will be removed and you can re-apply those patches using these copies.
  • Delete the original patch from Drupal installation after the patch is used.
  • This answer explains how to apply patches but does not answer the question as posed.
    – mona lisa
    Jul 12, 2016 at 3:43
  • I am sure Drush make will work but this answer is also valid for manual patch applying. So, is there a one single way to run Drupal core patches and how it should be done without damaging anything? Patch applying is same for drupal core patches. Jul 12, 2016 at 3:57
  • Generally you will need to do: patch -p1 < patch-file-name.patch
    – rooby
    Jul 12, 2016 at 5:57
  • Worth noting that almost always, patches will be written to be applied from the root of the site, the same as the root of the module for a module patch. Consider core to be one huge module.
    – rooby
    Jul 12, 2016 at 6:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.