I have a pre-commit hook defined as follows in a pre-commit-config.yaml
file located in the root of my repository -
repos:
- repo: https://gitlab.com/pycqa/flake8
rev: 3.7.9
hooks:
- id: flake8
This works as expected and blocks any commit if I am now following flake8 rules. However, I want to do this for a git push
and not for a git commit
. One way I found is to add a pre-push
file inside .git/hooks/
and do flake8 .
from inside. This does the job but now I can't share that file with anyone through git since the .git
folder is not tracked by git.
Is there any file/config that I can put in the root of the repo that will act as a pre-push hook?