step1) Add the file you want to modify:: git add vendor/magento/module-customer/Block/CustomerData.php -f step2) make changes to original file step3) git diff vendor/magento/module-customer/Block/CustomerData.php > yourPatchName.patch step3) you will get the patch file(yourPatchName.patch) in root directory step4) remove the changes you add to the file(vendor/magento/module-customer/Block/CustomerData.php) manullay by using ctrl+z step5) apply the patch using :: git apply yourPatchName.patch you will notice the changes in original file