Monday, 4 March 2019

Create and install magento2 patch files

1. Go to magento2 vendor directory

2.run command inside vendor directory

   git init


3. run following commands now

   git add -A

   git commit -m " temp added "



4. now modify which vendor file you want to modify and run command.


   git status

   after run above command you will get a modified file path.

5. now run below command 

   git diff change file path > mypatch_file.patch

   example : git diff magento/module-catalog/Model/Category.php > /home/usergroup/desktop/categorypatch.ptach

6. now delete .git directory from vendor directory

7. remove particuler changes which you did in file .

8. open patch file and add vendor directory in patch like below .

diff --git a/vendor/magento/module-catalog/Model/Category.php b/vendor/magento/module-catalog/Model/Category.php
index 57cfa75..7ab468a 100644
--- a/vendor/magento/module-catalog/Model/Category.php
+++ b/vendor/magento/module-catalog/Model/Category.php

9. now go to magento2 root and run below command for apply patch

 patch -p1 < /home/usergroup/desktop/categorypatch.ptach

 result will be : patching file vendor/magento/module-catalog/Model/Category.php

No comments:

Post a Comment