If you want any of your customization changes, then you can do it in core file let’s say Block.php which will be at
vendor/magento/module-cms/Block/Block.php.
1. Create a copy of that file with your changes on it.
2. Rename that file BlockModified.php.
3. Run the following command:
diff -u Block.php Block.php > cmsblock.patch.
4. Delete the BlockModified.php.
5. Move cmsblock.patch to root of magento in folder custompatches
6. Here comes the tricky part, you will need to do some manual modification. When you open the cmsblock.patch , you will get something like this on the top :
--- Block.php 2022-02-21 04:26:16.000000000 -0500 +++ BlockModified.php 2022-03-03 09:57:47.326011737 -0500
Replace those line with this one:
diff --git a/Block/Block.php .php b/Block/BlockModified.php index 3ee2rd..8349152 111644 --- a/Block/CustomerData.php +++ b/Block/CustomerData.php
7. Next Step is to add it in the composer.json n root of magento.Add the extra section.
"extra": {
"magento-force": "override",
"patches": {
"magento/module-cms": {
"some description about issue applying this patch":"custompatches/cmsblock.patch"
}
}
}
8. Run “composer install” to apply the patch

