Andrew Fletcher published: 13 April 2022 1 minute read
If you edit a Drupal contrib module, the next time the module is updated those edits will be wiped. So they are not lost there are a couple of options for you to consider:
- Are the edits worth the contributing to the community? Yes, you can fork the repo and add the changes for the developer(s) to review; or
- Create a patch file
Creating a patch file
The process:
Add the files you want to see in the diff. Remembering to only add untracked files.
git stash && git add . && git stash pop
Now diff the staged:
git diff --staged
Reset the staged files if needed
git reset
Can you run all of the steps in one chained command?
git stash && git add . && git stash pop && git diff --staged && git reset
Related articles
Andrew Fletcher
•
19 Apr 2024
Extending a Contrib Module's Configuration in Drupal 10: A Case Study with Sitewide Alert
Extending the functionality of a contrib module in Drupal can enhance its usefulness without altering the original codebase. This article provides a step-by-step guide on how to add custom configuration options to an existing contrib module, using the sitewide_alert module as an example. We will...
Andrew Fletcher
•
18 Apr 2024
LogicException: Form errors cannot be set after form validation has finished
When receiving a logic error such asLogicException: Form errors cannot be set after form validation has finished. in Drupal\Core\Form\FormState->setErrorByName() (line 1104 of /var/www/html/project/core/lib/Drupal/Core/Form/FormState.php).This error "LogicException: Form errors cannot be set...
Andrew Fletcher
•
09 Apr 2024
Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException
Adding a new service to a custom module and the following error greeted me:The website encountered an unexpected error. Try again later.
Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: You have requested a non-existent service "summaries.reference_node". in...