Why is this useful?

Why use hooks?

The goal of pre-commit hooks is to improve the quality of commits. This is achieved by making sure your commits meet some (formal) requirements, e.g:

As all changes enter a repository history with a commit, we believe many checks should be performed at that point, and not only later on a CI service. For example, creating auto-commits at a CI service for styling code creates unnecessary extra commits, as styling can be checked at the time of committing and is relatively inexpensive.

Why use the pre-commit framework?

Implementing hooks in a framework such as pre-commit.com has multiple benefits compared to using simple bash scripts in .git/hooks:

Have an idea for a hook? Please file an issue.



Try the precommit package in your browser

Any scripts or data that you put into this service are public.

precommit documentation built on Oct. 23, 2020, 6:18 p.m.