I'm trying to build a pre-commit script in git. In that script I plan on running tasks if a certain folder has changed. To test, in my script I have
git diff --cached | grep -q "^my/folder"
This results in...
Not a git repository
To compare two paths outside a working tree:
usage: git diff [--no-index] <path> <path>
pwd says I'm in the correct directory and $GIT_DIR is .git. I was lead to belive that --cached was the special sauce to get this working in a hook. Is there a way to do this?