Skip to content

Instantly share code, notes, and snippets.

@martinboy
Last active April 1, 2020 13:35
Show Gist options
  • Save martinboy/bbed918e841c9bb716a070f8b6f38afb to your computer and use it in GitHub Desktop.
Save martinboy/bbed918e841c9bb716a070f8b6f38afb to your computer and use it in GitHub Desktop.
Magento: In case when you need to create a custom patch for any code which is in gitignore (for example modules in vendor/ directory)
  1. cd <magento_root>
  2. mkdir -p m2-hotfixes/tmp
  3. Copy original files
    cp --parents <path/to/yout/file1> <path/to/yout/file2> ... m2-hotfixes/tmp
    OR
    rsync -R <path/to/yout/file1> <path/to/yout/file2> ... m2-hotfixes/tmp
  4. cd m2-hotfixes/tmp
  5. git init && git add . && git commit -m "Initial commit"
  6. Make changes in files in m2-hotfixes/tmp directory
  7. git add . && git commit -m "Fix something"
  8. git format-patch -1 HEAD -o ..
    format-patch will generate .patch file in m2-hotfixes directory
  9. cd <magento_root>
  10. rm -rf m2-hotfixes/tmp
  11. to apply all patches locally run the command
    vendor/bin/ece-tools patch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment