Code doesn't always work the way you expect it to. Sometimes you're going to have to use a patch.
Important
Acquia's Remote Administration (RA) service requires customers to follow specific steps when applying patches, to make sure that changes are not overwritten by RA updates. For more information, see Patching and locking modules.
Important
If you are using Drupal 8 and above using Composer please see Patching and locking modules.
Here are the steps for applying and testing a patch to a contributed module in your development environment on Acquia Cloud while using Git. These directions are also applicable to SVN users, but the repository-specific commands are different.
Note
For information and resources about Git, see the Git basics article.
git clone [site_Git_URL] [your production tag name]
The repository folder is created wherever the command line was when the git clone
command was run.
git checkout [your production tag name]
cd [repositoryname]
git checkout -b [new descriptive branch name]
You can download the patch to a temporary location such as your docroot's temp directory:
curl -s https://www.drupal.org/files/issues/[patch_name].patch > /tmp/patchfile.patch
Run a test to ensure the patch will apply cleanly.
patch -p1 --dry-run < /tmp/patchfile.patch
If this returns positive results, you can then apply the patch and remove the file.
patch -p1 < /tmp/patchfile.patchrm /tmp/patchfile.patch
Note
You can also combine all of these steps into a single command, which executes the test and applies the patch if the dry run completes normally:
# The && syntax ensures the next command only runs if the previous one was successful.curl -s https://www.drupal.org/files/issues/[patch_name].patch >/tmp/patchfile.patch && patch -p1 --dry-run < /tmp/patchfile.patch && patch -p1 < /tmp/patchfile.patch && rm /tmp/patchfile.patch
git commit -am \"Added patch for x issue\"
git push -u origin [branch name from step 5]
After you have completed your testing, you can then move the code into production. For information about patching Drupal, or patching using Git or SVN, you can also visit the Applying patches page on Drupal.org. For general information about Git, visit Git Immersion.
If this content did not answer your questions, try searching or contacting our support team for further assistance.
Wed Oct 22 2025 09:07:31 GMT+0000 (Coordinated Universal Time)