Git Product home page Git Product logo

git-hooks's Introduction

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.

git-hooks's People

Contributors

mmphego avatar stickler-ci avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.