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.
Use the --no-verify option to skip git commit hooks, e.g. git commit -m "commit message" --no-verify . When the --no-verify option is used, the pre-commit and commit-msg hooks are bypassed.
Open a terminal window by using option + T in GitKraken Client. Once the terminal windows is open, change directory to . git/hooks . Then use the command chmod +x pre-commit to make the pre-commit file executable.
pre-commit hooks are a mechanism of the version control system git. They let you execute code right before the commit. Confusingly, there is also a Python package called pre-commit which allows you to create and use pre-commit hooks with a way simpler interface.
Just run the pre-commit script through the shell:
bash .git/hooks/pre-commit
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 usepre-commit run <hook_id>.
So pre-commit run --all-files is what the OP is after.
Just run git commit. You don't have to add anything before doing this, hence in the end you get the message no changes added to commit.
For a single file:
pre-commit run --files YOUR_FILENAME
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With