Skip Git commit hooks
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
Introduction
To skip Git commit hooks, add --no-verify (or -n for short) to your git commit command: git commit --no-verify -m "your message". This bypasses pre-commit and commit-msg hooks. This article covers when skipping hooks is appropriate, how to do it for different Git operations, and how to selectively skip specific hooks without disabling all of them.
What Git Hooks Are and Why They Run
Git hooks are scripts that Git executes at specific points in a workflow. They live in .git/hooks/ and are triggered automatically. Here are the commit-related hooks that --no-verify affects:
| Hook | When It Runs | What It Typically Does |
pre-commit | Before the commit message editor opens | Linting, formatting, running tests |
commit-msg | After the commit message is entered | Validating commit message format |
And here are hooks that --no-verify does not skip:
| Hook | When It Runs | How to Skip |
prepare-commit-msg | Before the editor opens | Cannot be skipped with a flag |
post-commit | After the commit is created | Cannot be skipped with a flag |
pre-push | Before git push sends data | git push --no-verify |
pre-rebase | Before rebase starts | Cannot be skipped with a flag |
Method 1: The --no-verify Flag
The standard approach for a one-off skip:
This skips both pre-commit and commit-msg hooks. The commit goes through regardless of what the hooks would have done.
--no-verify works with other Git commands too
Method 2: Temporarily Disable a Specific Hook
If you want to disable a hook for a period (not just one commit), make it non-executable:
On Windows (where chmod does not work the same way), rename the hook:
Method 3: Environment Variables (For Hook-Aware Scripts)
Many modern hook frameworks (Husky, pre-commit, lint-staged) check environment variables:
Husky (v9+)
pre-commit framework (Python)
lint-staged (with Husky)
Method 4: Git Configuration
You can disable hooks entirely at the repository or global level:
To set this globally (use with caution):
Method 5: Git Aliases for Quick Access
If you frequently need to skip hooks, create an alias:
Or add to your shell profile:
Usage:
When Is It Appropriate to Skip Hooks?
Here is a practical guide:
| Scenario | Skip Hooks? | Reasoning |
| Urgent production hotfix | Yes | Speed matters, CI will catch issues |
| Work-in-progress commits (will squash later) | Yes | Hooks run on the final squashed commit |
| Fixing the hook itself | Yes | The broken hook would prevent its own fix |
| Merge commits with known conflicts resolved | Sometimes | If hooks fail on generated merge markers |
| Rebasing/amending existing commits | Sometimes | Hooks already passed on original commit |
| Normal feature development | No | Hooks exist to catch problems early |
| Commits that go directly to main/production | No | These commits need the most scrutiny |
What Modern Hook Frameworks Do
If your project uses a hook framework, here is how they work and what gets skipped:
Husky (Node.js projects)
Husky installs hooks via a .husky/ directory:
pre-commit (Python projects)
The .pre-commit-config.yaml defines hooks:
Selectively skip:
lefthook (Go projects and polyglot repos)
Common Pitfalls
- Making
--no-verifya habit. If you find yourself always skipping hooks, the hooks are either too slow, too strict, or running the wrong checks. Fix the hooks rather than bypassing them permanently. A pre-commit hook should complete in under 5 seconds for it to be practical. - Skipping hooks on shared/protected branches. If your team relies on hooks for commit message formatting or lint checks, skipping them on main or develop creates inconsistency. Use server-side hooks or CI checks as a safety net since they cannot be skipped with
--no-verify. - Forgetting to re-enable hooks. After
chmod -xorgit config core.hooksPath /dev/null, it is easy to forget that hooks are disabled. Use--no-verifyfor one-off skips instead, since it does not persist. - Assuming --no-verify skips all hooks. It only skips
pre-commitandcommit-msg. Post-commit hooks still run. Pre-push hooks requiregit push --no-verifyseparately. - Not setting up CI as a backstop. Client-side hooks are always optional. Any developer can skip them. Critical checks (linting, tests, security scans) should also run in CI, so skipped hooks do not reach production.
Summary
- Use
git commit --no-verify(or-n) to skippre-commitandcommit-msghooks for a single commit. - Use
git push --no-verifyto skippre-pushhooks. - For hook frameworks (Husky, pre-commit, lefthook), use their environment variables to selectively skip specific hooks rather than all of them.
- Reserve hook skipping for genuine exceptions: hotfixes, WIP commits that will be squashed, and fixing the hooks themselves.
- Always have CI running the same checks as a safety net, since client-side hooks can always be bypassed.
- If you frequently need to skip hooks, the hooks are too slow or too aggressive. Fix the underlying problem instead.

