title: Only perform git hook operation when files in specific folder changed
body: <p>I got 2 commands (which are not related to git) which I want to be executed both on commits (doesn't matter whether before or after) and after pulls.</p>
  
  <p>However, these commands take some time to run, so I don't want them to be executed on every commit or pull. They only do useful work if files in a specific folder changed since they last were run.</p>
  
  <p>They create or update a file ignored by git in that same folder. Of course, this file being changed shouldn't trigger execution of the commands the next time a commit or pull is performed. All files in that folder are on the top level of it (there are no subdirectories). All the files whose changes are relevant to whether the commands should be executed are tracked by git. When new files appear in the folder and aren't tracked by git yet, I don't care whether the commands are executed already. But they must be executed when a commit which adds them to the repo is created.</p>
  
  <p>How can this be tackled?</p>