Created
April 28, 2021 19:58
-
-
Save XigenDominic/65d282032c9f9f2756adc6fa53b54b70 to your computer and use it in GitHub Desktop.
Create magento 2 custom patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Patcher | |
composer require cweagans/composer-patches | |
git add -f ./vendor/magento/module-catalog/Model/ResourceModel/Product.php | |
# Edit file in vendor e.g. ./vendor/magento/module-catalog/Model/ResourceModel/Product.php | |
mkdir ./patches | |
mkdir ./patches/composer | |
git diff ./vendor/magento/module-catalog/Model/ResourceModel/Product.php > ./patches/composer/skeleton.patch | |
git reset HEAD ./vendor/magento/module-catalog/Model/ResourceModel/Product.php | |
# Undo change on file e.g. ./vendor/magento/module-catalog/Model/ResourceModel/Product.php | |
# composer json | |
``` | |
"extra": { | |
"magento-force": "override", | |
"composer-exit-on-patch-failure": true, | |
"patches": { | |
"magento/module-catalog": { | |
"Xigen import fix": "patches/composer/skeleton.patch" | |
} | |
} | |
} | |
``` | |
composer install | |
``` | |
composer install | |
Gathering patches for root package. | |
Removing package magento/module-catalog so that it can be re-installed and re-patched. | |
- Removing magento/module-catalog (103.0.5-p2) | |
Loading composer repositories with package information | |
Installing dependencies (including require-dev) from lock file | |
Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. It is recommended that you run `composer update` or `composer update <package name>`. | |
Package operations: 1 install, 0 updates, 0 removals | |
Gathering patches for root package. | |
Gathering patches for dependencies. This might take a minute. | |
- Installing magento/module-catalog (103.0.5-p2): Loading from cache | |
- Applying patches for magento/module-catalog | |
patches/composer/skeleton.patch (Xigen import fix) | |
``` | |
Check file |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Any tweaks to patch wording
composer update --lock