When I invoke:
pre-commit run --from-ref origin/develop --to-ref HEAD
: it runs on already committed filespre-commit run
: it runs on staged files
Is there a way to have pre-commit
run on both in one command?
CodePudding user response:
I'm not sure why you would ever want to do that -- seems like an XY problem
that said, it's always possible to utilize pre-commit run --files
to run on whatever set of files you want to
combining the two:
(git diff --staged --name-only -z && git diff --name-only -z origin/develop...HEAD) | xargs -0 pre-commit run --files
disclaimer: I wrote pre-commit