For nodejs/npm users there’s also husky as an equivalent to python’s pre-commit mentioned. If it’s specified in a project (dev?) dependencies, I seem to remember that an npm install sets up the defined hooks automatically and seamlessly, which is quite practical for bootstrapping new contributors.
I appreciate the new git config core.hooksPath <dir> option so that I can commit my hooks to the repo.
git config core.hooksPath <dir>