I was wondering if there was a simple way to set up a post commit git hook so that it would run regardless of the repo that it is run with (It is my understanding that the applied hook comes from a hook/ folder in the git directory).
Thank you!
This actually has a relatively simple answer, but it was a nightmare to find. Here's the terminal commands I used to do it, it works perfectly.
git config --global init.templatedir '~/.git-templates' mkdir -p ~/.git-templates/hooks cp post-commit ~/.git-templates/hooks/ chmod a+x ~/.git-templates/hooks/post-commit In this example post-commit is an executable bash script
git-mycommitthat does whatever hook-like things you want and then ultimately callsgit commit, and as long as it is in yourPATHsomewhere, you can call it asgit mycommit(gitwill search for alternative commands namedgit-foowhen an unknowngit foosubcommand is given to it). Of course then you have to train yourself (and everyone else) not to usegit commit, but to use your custom command instead...