Global Git Hooks
You can create global git hooks by:
- setting $GITTEMPLATEDIR
- git init --template ~/.mygittemplatesorsomething
- putting your scripts in $GIT_PREFIX/git-core/templates/hooks
I made one that takes a picture every time I commit. I recommend it for personal amusement.
Written by Joseph Randall Hunt
Related protips
2 Responses
Would like to add that you can:
- place your hook into
$PREFIX/share/git-core/templates/hooks
where$PREFIX
is/usr
or/usr/local
to make that hook "global". - place your hook into home dir somewhere just like this tip suggests and set init.template_directory git variable to point that dir, instead of explicitly specifying it every time.
See: http://stackoverflow.com/questions/2293498/git-commit-hooks-global-settings
over 1 year ago
·
yes your first suggestion is the same as III
the issue with that one is that whenever you update git it will often remove the hooks :(
I like your second one.
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Git
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#