Apply custom patches
Sometimes we provide a custom patch to address a specific issue. Also, third-party extension developers can provide a custom patch. Copy the custom patch to the /m2-hotfixes
directory and test it on your local workstation.
Before beginning an upgrade or a patching process, create an active branch from the Integration environment and checkout the new branch to your local workstation. Dedicating a branch to the upgrade or the patch process helps to avoid interference with your work in progress.
To apply and test a custom patch:
You can only apply patches during the build phase of redeployment.
-
On your local workstation, create a branch based on the
integration
branch.1
magento-cloud environment:branch <branch-name>
-
Copy the patch file to the
/m2-hotfixes
directory. -
Add, commit, and push your code changes.
1
git add -A && git commit -m "Apply patch" && git push origin <branch name>
-
After test validation, merge this branch with the
integration
branch.
To test if a patch can be applied using your local workstation:
-
From the project root, apply the patch.
1
git apply ./m2-hotfixes/<patch-file-name>
-
Clear the Magento cache.
1
php ./bin/magento cache:clean
You can also clean the cache using the Magento Admin Cache Management.
-
Test the patch, make any necessary changes.