0

Because we use a devOps system that installs packages on the server via Composer, my core drupal installation and contrib modules are not in version control (Git).

I used to patch modules as follows:

  • Commit everything, so my branch is up-to-date.
  • Make my changes to the module (= write the fixes in the module).
  • Inside my code editor go to Code -> Create patch and follow the steps there (because of Git, my editor knows what has changed).
  • My patch gets saved where I prefer to do it.

Since we started working with keeping modules and core out of Git I do not have a clue on how to create my patches anymore.

Curious about the solutions you might have!

  • 1
    See github.com/cweagans/composer-patches for the approved method. – Alfred Armstrong Sep 6 '19 at 15:19
  • It is not about how to apply it, but about how to create it (edited my question) – Stef Van Looveren Sep 6 '19 at 15:38
  • 1
    Follow the Making a Drupal patch with GIt documentation on d.o for how to create patches. – sonfd Sep 6 '19 at 15:43
  • 2
    @StefVanLooveren The answer is basically “however you want/can”, there’s no standardised process for doing something like what you’re describing. If this was forced on me I’d probably cobble together a couple of bash scripts that make copies of the site then run diff on them when required to. But it would be painful. Thing is, everything you’re talking about (Drupal and its contrib modules) lives in git already. So, arguably, you should create your patches using git, and make them available to your Composer workflow separately for installation – Clive Sep 6 '19 at 16:16
  • 2
    If the patch fixes an issue with a contrib module, then I always add or update a relevant ticket and upload the patch so it is available to others. The process is well documented on drupal.org. – Alfred Armstrong Sep 6 '19 at 16:52
0

So, you would have to download the module seperately, like:

git clone --branch 8.1.x http://git.drupal.org/project/colorbox.git

Then, you make the change and run the following:

git diff 8.1.x > colorbox-css-issue.patch

This creates a patch for this module. Now you can place the patch in a patches folder and add it to your composer.json file. Helpful source: https://www.drupal.org/node/707484

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.