$ pip install pre-commit create a file named .pre-commit-config.yaml you can generate a very basic configuration using $ pre-commit sample-config $ pre-commit install now pre-commit will run automatically on $ git commit