There are times where it is not possible to override an core function or a possible github fix for an issue in Magento, and you are not updating the current version to get the fix.
Times like these where git patches comes to the rescue.
The basic syntax for apply git patches
git apply <location-of-your-patch-file>
Suppose we are ought to modify the file
vendor/magento/module-customer/Block/CustomerData.php
and create a custom patch.
- Create a copy of that file in the same location
vendor/magento/module-customer/Block/CustomerDataModified.php
- Modify the changes in the new file and save it.
- At this point, the vendor folders are ignored and you want to force git to find difference between two files, so we run the command
diff -u CustomerData.php CustomerDataModified.php > diff.patch
This will generate a file 'diff.patch' in your root directory.
Top comments (0)