Create a local patch for a module
Find module repo on git hub and clone it localy on your machine.
Open folder with your IDE and make any changes you want.
Run git diff > YOUR_PATCH_NAME.patch
Copy patch file to your drupal project (ie /ROOT_DIR/patches/YOUR_PATCH_NAME.patch)
Add it to composer under patches
Run composer update