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

callum picture callum · Jan 17, 2018 · Viewed 24.4k times · Source

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.

Answer

Ilayaraja picture Ilayaraja · Jan 17, 2018

Just run the pre-commit script through shell:

bash .git/hooks/pre-commit