To run additional checks before making commit we use Pre-commit hooks.
pre-commit
package is installed with backend requirements, so there is no need of manual installation.
But you need to generate the actual git pre-commit hook. It should be done only once:
pre-commit install
To run pre-commit hooks manually:
pre-commit run --all-files
To run specific hook:
pre-commit run <hook_id>
See more info in official documentation: