Skip to main content

Create git hooks with ease using a simple configuration file in a git project

Project description


code linting: flake8 code quality: pytest MIT license CircleCI

Create git hooks with ease using a simple configuration file in a git project


pip install python-githooks


  1. Create a .githooks.ini configuration file(If not provided a dummy configuration file will be created).
  2. Add sections based on git hooks names followed by a command property with the shell code you want to run.
  3. Run either python -m python_githooks or githooks in you virtual environment.
  • Configuration file Example:
# .githooks.ini

command = pytest --cov

command = pytest --cov && flake8
  • Remember to re-run python -m python_githooks or githooks every time you make changes to the configuration file, whether it is for adding new hooks or modifying the current ones.

Removing a hook

If you already created a hook and now want to remove it, just set the command value to empty, like this:

# .githooks.ini

command = 

This will not actually physically remove the hook from the git local project, just will make it instantly exit with 0 status code.


python-githooks is MIT-licensed.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for python-githooks, version 1.0.6
Filename, size File type Python version Upload date Hashes
Filename, size python_githooks-1.0.6-py3-none-any.whl (4.9 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size python-githooks-1.0.6.tar.gz (3.2 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page