Skip to content
⚓️ A curated list of awesome git hooks
Shell Perl Python JavaScript
Branch: master
Clone or download
Latest commit a6bf07c Oct 13, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github/ISSUE_TEMPLATE Update issue templates Aug 22, 2019
commit-msg-hooks Add requirements comments, update bash shebangs Aug 22, 2019
post-checkout-hooks Add requirements comments, update bash shebangs Aug 22, 2019
post-update-hooks Add requirements comments, update bash shebangs Aug 22, 2019
pre-commit-hooks Don't add deleted files Oct 8, 2019
pre-push-hooks Add requirements comments, update bash shebangs Aug 22, 2019
pre-rebase-hooks Add requirements comments, update bash shebangs Aug 22, 2019
prepare-commit-msg-hooks Add requirements comments, update bash shebangs Aug 22, 2019
query-watchman-hooks Add requirements comments, update bash shebangs Aug 22, 2019
tests Add spell check for md files unit tests Oct 9, 2019
update-hooks Add requirements comments, update bash shebangs Aug 22, 2019
.gitignore Create verify-name-and-email-test.bats Aug 24, 2019
.travis.yml Add aspell to TravisCI Oct 13, 2019
CODE-OF-CONDUCT.md Update project to comply with awesome requirements Jul 27, 2019
CONTRIBUTING.md Add Prettier Aug 24, 2019
LICENSE Resolve awesome lint errors, update license Jul 27, 2019
README.md Add `pre-commit` to list of tools Oct 1, 2019
bash-icon.png Add language icons Aug 22, 2019
create-new-file.gif Update README.md Jul 15, 2019
git-logo.png Add Git logo, improve wording Jul 27, 2019
package-lock.json Add bats-mock dev dependency Aug 16, 2019
package.json Update TravisCI Aug 24, 2019
perl-icon.png Add language icons Aug 22, 2019
prettier.config.js Add Prettier Aug 24, 2019
python-icon.png Add language icons Aug 22, 2019

README.md

Awesome Git Hooks
Awesome Git Hooks

Awesome Lists PRs welcome

Awesome Git Hooks

⚓️ 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.

✔️ Nothing to install/download

✔️ Code is well-documented

✔️ 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

Note: The icon next to each script signifies what language it is written in.

icon language icon language
Bash Icon bash Perl Icon perl
Python Icon python

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. Python Icon

post-checkout

  • delete-pyc-files - Delete all .pyc files every time a new branch is checked out. Python Icon
  • new-branch-alert - Display a message when a new branch is checked out for the first time. Bash Icon

post-update

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

pre-commit

prepare-commit-msg

pre-push

  • prevent-bad-push - Prevent push of commits where the log message starts with "WIP" (work in progress). Bash Icon

pre-rebase

  • prevent-rebase - Prevent topic branches that are already merged to 'next' branch from getting rebased, because allowing it would result in rebasing already published history. Bash Icon

query-watchman

  • fsmonitor-watchman - Output to stdout all files that have been modified since a given time. Perl Icon

update

  • update - Block unannotated tags from entering. Bash Icon

Quick Start

  1. Pick a hook, any hook! Try the "verify-name-and-email" one if you're not sure where to start.
  2. Navigate to your project's hooks folder (.git/hooks).
  3. You should see a list of files already in there. Create a new file called the exact commit type that you want to use (eg: "commit-msg", "pre-rebase", "pre-commit", etc). Do not give it an extension.

create new file

  1. Open your new file and paste the code from the hook you chose out of this repo (eg: verify-name-and-email.hook).
  2. Save file. Done! Now the git hook will be triggered automatically.

Tools

  • Husky - Manage git hooks with a nice user interface.

  • Overcommit - A fully configurable and extendable git hook manager.

  • Git Hooks - Manage project, user, and global git hooks more easily.

  • CaptainHook - Git hooks manager for PHP developers.

  • pre-commit - A framework for managing and maintaining multi-language pre-commit hooks.

Written Guides

Video Guides

License

CC0
This work is licensed under a Creative Commons Attribution 1.0 International License.

You can’t perform that action at this time.