0

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?

Ananda
  • 2,925
  • 5
  • 22
  • 45
  • 1
    I'm voting to reopen since this is about `pre-push` support in [pre-commit.com], which [is supported](https://pre-commit.com/#pre-commit-during-push) – anthony sottile Sep 11 '20 at 16:35
  • Woah, this is exactly what I was looking for. Thanks! I didn't know you had this option in pre-commit. – Ananda Sep 13 '20 at 17:39

0 Answers0