Skip to content
This repository was archived by the owner on Aug 26, 2019. It is now read-only.

mmphego/git-hooks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

72 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Git-hooks

Deprecation Notice

This project has been superseded by pre-commit-hooks A framework for managing and maintaining multi-language pre-commit hooks, which is far more flexible and feature-rich than this project can provide.

It is recommended to use that instead.

GitHub

A simple shell script to support per-repository Git hooks, checked into the actual repository that uses them.

To make this work, it creates hook templates that are installed into the .git/hooks folders automatically on git init and git clone. When one of them executes, it will try to find matching files in the .git/hooks directory under the project root, and invoke them one-by-one.

Check out the blog post for the long read!

Layout and options

Take this snippet of a project layout as an example:

├── hooks
│   ├── commit-msg
│   ├── pre-commit
│   └── prepare-commit-msg
├── LICENSE
├── pip-requirements.txt
├── README.md
├── setup_hooks.sh
└── templates
    └── git-commit-template.txt

Supported hooks

The supported hooks are listed below. Refer to the Git documentation for information on what they do and what parameters they receive.

  • pre-commit
  • prepare-commit-msg
  • commit-msg

Installation

To install the template and git-hooks, run:

 sudo ./setup_hooks.sh install_hooks

The script will:

  1. Find all directories under the /home which contain any .git directory
  2. Install the hooks into them
  3. Sets init.templateDir to point to templates/git-commit-template.txt

Uninstalling

If you want to get rid of these hooks and templates, you can run:

 sudo ./setup_hooks.sh delete_hooks

This will delete the template files, optionally the installed hooks from the existing local repositories.

About

My personal githooks

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages