Today I Learned

hashrocket A Hashrocket project

Global git hooks

There are no global git hooks.

But you can create global hook templates and for every project you can use them.

Create a folder for your global templates:

mkdir -p ~/.git-templates/hooks

Configure git to use this templates folder:

git config --global init.templatedir '~/.git-templates'

Create an executable hook, for example `~/.git-templates/hooks/pre-commit bash #!/bin/sh echo "This happens before the commit" For every project you want to use these templates restart git project running: bash git init These will create symbol links like: bash lrwxr-xr-x pre-commit -> /Users/vnegrisolo/.git-templates/hooks/pre-commit

See More #git TILs