We’d like to make a few basic hook scripts that we can all share — for things like pre-formatting commit messages. Git has hook scripts for that that are normally stored under <project>/.git/hooks/. However, those scripts are not propagated when people do a clone and they are not version controlled.
Is there a good way to help everyone get the right hook scripts? Can I just make those hook scripts point to version controlled scripts in my repo?
Theoretically, you could create a
hooksdirectory (or whatever name you prefer) in your project directory with all the scripts, and then symlink them in.git/hooks. Of course, each person who cloned the repo would have to set up these symlinks (although you could get really fancy and have a deploy script that the cloner could run to set them up semi-automatically).To do the symlink on *nix, all you need to do is:
use
ln -sfif you’re ready to overwrite what’s in.git/hooks