I want to ignore any dist
and node_modules
directories in my git commit hook. I've tried this:
git diff --cached --name-only --diff-filter=ACM | find . -path ./node_modules -prune -o -path './**/dist -prune -o -name '*.js'
But it doesn't work. It doesn't seem like the find is accepting the files found from the git diff...
If I run:
git diff --cached --name-only --diff-filter=ACM
I correctly get the staged files:
./dist/some-file.js
And if I run:
find . -path ./node_modules -prune -o -path './**/dist' -prune -o -name '*.js' -print
I correctly get a list of files that don't include any that are in dist
or node_modules
directories.
How can I combine these do that my git hook doesn't pick up staged files in dist directories.