TLDR;

  1. Install cweagans/composer-patches module via composer:
1
composer require cweagans/composer-patches
  1. Modify <root>/composer.json to include the core/module/theme patch:
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
...
"require": {...},
"require-dev": {...},
"extra": {
+    "patches": {
+        "drupal/pathauto": {
+            "Issue #3275041": "https://www.drupal.org/files/issues/2022-04-13/add_bypass_uniquifier_settings-3275041-2.patch"
+        }
    },
    "drupal-scaffold": {...},
    "installer-paths": {...}
}
...
  1. Run corresponding composer update command (e.g. for the above we applied patch for pathauto module):
1
composer update drupal/pathauto
  1. Clear cache via druah command
1
drush cr

Reference

PENDING TO READ THESE PAGES FOR MORE DETAILS

1
2
3
4
5
6
7
8
9
- https://www.drupal.org/docs/develop/git/using-git-to-contribute-to-drupal/working-with-patches/applying-a-patch-in-a-feature-branch
- https://www.drupal.org/project/drupal/issues/3345661
- (you need to install gpatch first ???????)

- https://www.drupal.org/forum/support/module-development-and-code-questions/2019-08-05/core-patch-not-installing-with
- https://www.drupal.org/docs/develop/using-composer/manage-dependencies#s-patching-drupal-core
- (cweagans/composer-patches ????????)

- https://gorannikolovski.com/blog/how-to-apply-a-patch-in-drupal