Apply Magento2 Patch manually using GIT

The best easy way is to simulate the directory path, so lets assume you will need to fix the comparison page after you upgrade to Magento 2.3.5-p2

Filename: vendor/magento/module-catalog/Helper/Output.php

we need to replace this line 

- if (preg_match($pattern, $attributeHtml)) {

with this line 

+ if (preg_match($pattern, (string) $attributeHtml)) {


Now create those directories vendor/magento/module-catalog/Helper