How to manually run a git pre-commit hook, without attempting a commit?

前端 未结 3 1591
情书的邮戳
情书的邮戳 2021-02-01 12:01

I just want to be able to run it to see if the code in my working tree passes it, without actually attempting a commit.

3条回答
  •  半阙折子戏
    2021-02-01 12:49

    There's a Python package for this available here. Per the usage documentation:

    If you want to manually run all pre-commit hooks on a repository, run pre-commit run --all-files. To run individual hooks use pre-commit run .

    So pre-commit run --all-files is what the OP is after.

提交回复
热议问题