How to skip Git commit hooks
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.
# Skip Git commit hooks
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
about:blank
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.
The hook is used to make sure that our commit message conforms to a required pattern.
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.
# Details
Published on March 11, 2024 • 2 min read