sharing git hooks

getting those git hooks to everyone

SEAN K.H. LIAO

sharing git hooks

getting those git hooks to everyone

git hooks

git has hooks, useful for executing scripts on some events, like making sure everyone ran that formatter... Anyway, the problem is that it lives outside of version control and probably for good reason: if it's a symlink and references the main working space, checking out a different ref might change what hooks are run.

But you don't care, anyway, there are (or were) several projects to install them:

but the easiest way if you don't care about the symlink problem (or change to cp and pester collaborators to rerun every time you update it if you do) might just be something like this in a Makefile:

1install-hooks:
2        rm -rf .git/hooks
3        ln -s ../hooks .git/hooks
4        chmod +x hooks/*