
Awesome Git Hooks
Awesome Git Hooks
:anchor: Easy-to-use git hooks for automating tasks during git workflows.
Git hooks are custom scripts you can use to automate tasks which are triggered before or after a git command is executed. There are two groups of these hooks: client-side and server-side. Client-side hooks are triggered by operations such as committing and merging, while server-side hooks run on network operations such as receiving pushed commits. This repo contains helpful resources as well as a variety of git hook scripts that can be easily customized to serve different purposes.
:heavy_check_mark: Nothing to install/download
:heavy_check_mark: Code is well-documented
:heavy_check_mark: Grab & go! Copy the code you want to use and paste into your .git/hooks folder
Contributions are always welcome! Please see our Contribution Guidelines. Also, if you don't find the script you want below, you can create a new issue to request it.
Contents
- Git Hook Scripts
- commit-msg
- post-checkout
- post-update
- pre-commit
- prepare-commit-msg
- pre-push
- pre-rebase
- query-watchman
- update
- Quick Start
- Tools
- Written Guides
- Video Guides
Git Hook Scripts
Note: The icon next to each script signifies what language it is written in.
| icon | language |
|---|---|
bash |
|
python |
|
perl |
commit-msg
- enforce-insert-issue-number - Make sure user did not delete the ISSUE-[#] string that was generated by prepare-commit-msg/insert-issue-number.hook.

post-checkout
- delete-pyc-files - Delete all .pyc files every time a new branch is checked out.

- new-branch-alert - Display a message when a new branch is checked out for the first time.

post-update
- update-server-info - Prepare a packed repository for use over dumb transports (e.g. http).

pre-commit
- dotenvx - Prevent committing your
.envfile(s) to code.
- format-code - Run command to format code and re-add any files modified after formatting.

- search-term - Fail commit if a specific term is found in the code.

- spell-check-md-files - Check files with .md extension for spelling errors.

- verify-name-and-email - Fail commit if user.name or user.email is incorrect.

prepare-commit-msg
- include-git-diff-name-status - Include the output of "git diff --name-status -r" into the message, just before the "git status" output.
