Skip to main content

pre-commit hook for Git

Project description

git-pre-commit-hook - pre-commit hook for Git.


You can install, upgrade, uninstall git-pre-commit-hook with these commands:

$ pip install git-pre-commit-hook
$ pip install --upgrade git-pre-commit-hook
$ pip uninstall git-pre-commit-hook


  • Work fine with initial commit.
  • Work fine with all filenames.
  • Work with index contents instead of working copy.
  • Plugin architecture: adding new checks is easy.
  • Builtin plugins for:
    • validate json files
    • validate Python-code with flake8 (with pep8-naming)
    • validate .rst files
    • validate .yaml files
    • check filesize


Install hook to current Git-repository:

git-pre-commit-hook install \
  --plugin flake8 \
  --plugin json \
  --plugin file_size \
  --plugin rst \
  --plugin yaml

Installed hook rejects commits:

  • if any file has size greater than 10MB
  • if files with .json extension contains invalid JSON
  • if Python-code doesn’t pass check with flake8 (with pep8-naming)
  • if files with .rst extension contains invalid RST
  • if files with .yaml extension contains invalid YAML

List available plugins:

git-pre-commit-hook list-plugins

Show information about plugin:

git-pre-commit-hook show-plugin-info json

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 git-pre-commit-hook, version 0.0.4
Filename, size File type Python version Upload date Hashes
Filename, size git-pre-commit-hook-0.0.4.tar.gz (4.5 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 Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page