magento 2 vendor git diff & apply patch
<p>Mainly, this question is specific to git with Magento 2. I have a working Magento 2 project and I have installed an extension using github repo - <a href="https://github.com/Adyen/adyen-magento2">https://github.com/Adyen/adyen-magento2</a>. </p>

<p>In my current situation, I have to debug that extension and have to check on my remote server. I have forked that repo and created a patch say for e.g. cc_debug.patch file. Now, I have added that patch to my root directory on local server. Then if I execute patch using <code>git apply --apply --directory=vendor/adyen/module-payment/ cc_debug.patch</code> it does the trick and modify the files under vendor directory. I pushed the changes over repo and due to deployment script, that file moved to remote server.</p>

<p>Now, I do have only read access over remote server and there is no .git initialized. If I do apply patch over remote server, it will be executed certainly but if I push next time, due to deployment script vendor will be regenerated and changes applied by patch will be lost. Here comes some hook into picture as I know but I am having lack of knowledge regarding hooks.</p>

<p>I assume that I do have to create post-deploy hook in my git local repo such as below:</p>

<pre><code>#!/bin/sh

patchfile = "cc_debug.patch"
patchingdirectory = "vendor/adyen/module-payment/"
if [ -f "$patchfile" ]
then
    git apply --apply --directory=$patchingdirectory $patchfile
fi
</code></pre>

<p>Now, I can't push that hook to remote repo(not even initialized) so that this solution won't work for me. Or as I know post-update is something specific to remote (correct me if I am wrong) so I am guessing that changes will be executed over remote server due to this hook but if I clone again on another local machine, I do have to create post-deploy patch again, so that isn't the ideal case.</p>

<p>What could be solution for me to apply patch everytime deployment script gets executed? [Note: deployment script is not in my hands as it is executed by webhooks provided by Magento over github. So, I am assuming that there must be some webhook using which I'll have to apply patch and that's again my lack of knowledge.] I am sure someone have the same situation as mine. Please guide me. TIA.</p>