Awesome
Awesome Git Hooks
A curated list of awesome Git hooks
Git Hooks are scripts that run automatically every time a particular event occurs in a Git repository.
Contents
Useful Git Hooks scripts
- pre-commit - This hook is called before obtaining the proposed commit message.
- prepare-commit-msg - Called after receiving the default commit message, just prior to firing up the commit message editor.
- pre-receive - This is called on the remote repo just before updating the pushed refs.
- commit-msg - Can be used to adjust the message after it has been edited in order to ensure conformity to a standard or to reject based on any criteria.
- pre-push - Called prior to a push to a remote. In addition to the parameters, additional information, separated by a space is passed in through stdin in the form of
<local ref> <local sha1> <remote ref> <remote sha1>
. - pre-auto-gc - Is used to do some checks before automatically cleaning repos.
- pre-rebase - Called when rebasing a branch. Mainly used to halt the rebase if it is not desirable.
- applypatch-msg - Can edit the commit message file and is often used to verify or actively format a patch's message to a project's standards.
- post-receive - This is run on the remote when pushing after the all refs have been updated. It does not take parameters, but receives info through stdin in the form of
<old-value> <new-value> <ref-name>
. - post-rewrite - This is called when git commands are rewriting already committed data.
- post-commit - Called after a successful commit. Useful for triggering notifications, etc.
Tools
- Husky - Git hooks made easy.
- Komondor - Git Hooks for Swift projects.
- Quickhook - Faster Git hook (pre-commit, etc.) runner.
- overcommit - A fully configurable and extendable Git hook manager.
- Grunt GitHooks - Setup, manage and update your hooks with Grunt. Can be used with all languages, supports templates.
- Autohook - A very, very small Git hook manager with focus on automation.
- Githooks - Auto-install Git hook, that supports hooks in any language checked into Git and also shared repos.
- Hooks - A command line git hook management tool.
- Lefthook - Fast and powerful Git hooks manager for any type of projects.
- pre-commit - A framework for managing and maintaining multi-language pre-commit hooks.
Projects
- Lolcommits - Takes a snapshot with your webcam every time you git commit code, and archives a lolcat style image with it.
- Podmena - Enhance your commit messages adding random emoji to it.
- Git::Hooks - A framework for implementing Git (and Gerrit) hooks.
- App::GitHooks - A modular and easy to configure git hooks framework, supporting many plugins.
- Jig - A pre-commit hook on steroids.
- GitPHPHooks - Write your hooks in PHP, manage and organize them on a task and project level. Has an additional Hooks library on GitHub.
- git-hooks-php - Git hooks for PHP based projects.
- commandbox-githooks - Git hooks for CommandBox CFML based projects.
- hooks4git - A simple, flexible and language agnostic git hook management approach.
- Commit Colors - See a color swatch in your terminal every time you author a commit.
Articles
- Official Documentation
- Git Hooks (Part I): The Basics
- Git Hooks (Part II): Implementing Git Hooks using Python
- Atlassian Git Hooks tutorial
- Tips for using Git pre commit hook
- Use a boostrap shell script to use Git Hooks in Mac with PowerShell and with IntelliJ
- githooks.com
- How To Use Git Hooks To Automate Development and Deployment Tasks
- Automate your workflow with git hooks
- Automate your development workflow
- Deploying websites with a Git hook
- The missing Git hooks documentation
Video Tutorials
- Introduction to Git Hooks
- Git hooks, practical uses (yes, even on Windows)
- Life’s better with Git hooks
- Husky and the Git Hooks
Support
If you have a question, find a bug, or just want to say hi, please open an issue on GitHub. If you want to contribute, please read the guide.
License
To the extent possible under law, Islam Temirbek has waived all copyright and related or neighboring rights to this work.