all.bash script runs quickly enough so that you can use it as a git pre-commit hook. If you don't already have a pre-commit hook, you can install it with
ln -s -f ../../all.bash .git/hooks/pre-commit
all.bash to an existing pre-commit hook, edit
.git/hooks/pre-commit and add the line
You may prefer to run
all.bash only when you push (which happens when you run
git codereview mail). You'll need a small script to discard the arguments that the pre-push hook is called with. Make this the contents of
chmod +x .git/hooks/pre-push
all.bash script can be used to selectively run actions on the source (e.g. linters, code formatters, or tests). Run
./all.bash help to see a list of supported actions.
Some actions are not run by the default invocation of
./all.bash that is executed in the commit hook. Notably, the
prettier command is not run, because it has a dependency on nodejs, which is otherwise not needed and which not all developers have installed on their system.
./all.bash prettier to format your changes before mailing your CL.