Last updated: Apr 5, 2024
Reading time·2 min
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.
git commit -m "commit message" --no-verify git push --no-verify
You can also use the -n
option, which is short for --no-verify
.
git commit -m "commit message" -n
If you use the husky package for your git
hooks, you can also prefix the command with the HUSKY=0
environment variable.
# HUSKY=0 git YOUR_COMMAND_HERE HUSKY=0 git commit -m "commit message" HUSKY=0 git cherry-pick --continue
If the suggestions above didn't solve your issue, you can comment out the specific git hook by:
.git/hooks/pre-commit
.# . "$(dirname "$0")/husky.sh"
.The hooks are located in the .git/hooks/
directory.
The
--no-verify
option can be used to bypass the pre-commit
and commit-msg
hooks.
The pre-commit hook is run first and is used to inspect the snapshot that's about to be committed.
The pre-commit
hook can be used to run tests, lint, type check, etc. If the
hook exists with a non-zero code, the commit is aborted.
The commit-msg hook is also
skipped by the --no-verify
option. This hook is invoked when using the
git commit
or git merge
commands.
If the commit-msg
hook exists with a non-zero code, the commit is aborted.
After the pre-commit
and commit-msg
hooks run, the
post-commit hook runs. This
hook is often used for notification purposes.
The pre-merge-commit hook
can also be bypassed with the --no-verify
option. This hook is invoked after
the merge has been carried out successfully and before obtaining the commit log
message.