Home

Awesome

<h1 align="center"> <a href="https://git-scm.com/"> <img width="455" src="https://github.com/compscilauren/awesome-git-hooks/blob/master/git-logo.png" alt="Awesome Git Hooks"></a><br>Awesome Git Hooks </h1> <p align="center"> <a href="https://awesome.re"><img src="https://awesome.re/badge-flat2.svg" alt="Awesome Lists"></a> <a href="https://github.com/CompSciLauren/awesome-git-hooks/blob/master/CONTRIBUTING.md"><img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square" alt="PRs welcome"></a> </p>

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

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

iconlanguage
<img width="14" src="bash-icon.png" alt="Bash Icon">bash
<img width="14" src="python-icon.png" alt="Python Icon">python
<img width="14" src="perl-icon.png" alt="Perl Icon">perl

commit-msg

post-checkout

post-update

pre-commit

prepare-commit-msg

pre-push

pre-rebase

query-watchman

update

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

Written Guides

Video Guides

License

CC0<br />This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by/1.0/">Creative Commons Attribution 1.0 International License</a>.