Hooks
Hooks are local to a git repo they are not copied over to the new repository when you run git clone
In shared dev team, typically hooks are stored in the project directory itself in a seperate hooks directory, which is version controlled.
A new dev needs to either symlink or copy hooks to local .git/hooks
Sample hook files are by default generated by git in a git repo in the directory .git/hooks . The .sample suffix of the filenames prevent them from executing
Hooks are simple executable scripts, by default sh, but can be written in any scripting language using #!/usr/bin/env <executable>
Client Side (local) Hooks
pre-commitprepare-commit-msgcommit-msgpost-commitpost-checkoutpre-rebase
Server Side Hooks
pre-receive: called once before receiving the pushed changesupdate: called every time before arefis updated i.e. before every commit being added to remote repopost-receive: called once after thepushfor all refs is completed
References
manpage: https://git-scm.com/docs/githooks
useful examples: https://www.atlassian.com/git/tutorials/git-hooks