That could work, but there is a problem with this approach (the last part of it):
Not all projects use git, but the ones that do:
It is possible to set up a global pre-commit hook in git, but it requires some manual configuration because git does not natively support global hooks out of the box. By default, hooks are local to each repository and reside in the .git/hooks directory.
You could do:
git config --global core.hooksPath ~/.git-hooks
But... setting `core.hooksPath` overrides the use of local hooks in .git/hooks.
At least you can combine global and local hooks by modifying your global hook scripts to manually invoke the local hooks.