pre-commit
Run first. It is used to inspect snapshot. Can be used to check if tests are run, code styling, documentation was applied.

        
prepare-commit-msg
Run before the commit message editor is fired but after the default msg is created Params
  • path to file containing msg
  • type of commit
  • sha of commit if it is an amended commit

        
commit-msg
Can be used to validate final commit msg and abort if it's not correct. Takes path to file containing msg as param

        
post-commit
Can be used for notification of commit. Does not take any parameter.

        
applypatch-msg
First hook run after git am command. Takes one parameter that is path to file containing msg

        
pre-applypatch
Run after patch is applied but before commit is created. Can be used to run tests, inspect working tree. Can be used to abort commit by returning non zero value

        
post-applypatch
Runs after commit is made. Can be used to notify of the commit

        
pre-rebase
Run before you rebase anything. Can be use to halt git rebase. Can be used to disallow rebasing any commit which have been pushed already

        
post-rewrite
Run after commits are rewritten by either git rebase or git commit --amend but not git filter-branch. Param is the command which triggered rewrite. And list of commits as stdin . This can be used to setup working directory after rewrite.

        
post-checkout
Runs after checkout. Can be used to setup working directory, like moving large files , auto generating documentation etc.

        
post-merge
Runs after a successful merge

        
pre-push
Runs after remote refs have been updated but no data has been transmitted yet. It receives name and location of remote as params and list of to be updated refs as stdin

        
pre-auto-gc
Runs before GC takes place and can be used to notify or abort GC based on some criteria.

        
pre-recieve
Runs when data from push is received . can be used to reject push completely

        
update
Similar to pre-recieve but is executed once for each branch. Can be used to reject push for branches selectively

        
post-recieve
Runs after entire process is complete. Can be used to notify usees or other systems. Client waits for this this script to return before disconnecting. So, should not do long blocking tasks.