Skip to main content

Skip flake8 (or Any pre-commit Hook) the Smart Way

· 2 min read
Serhii Hrekov
software engineer, creator, artist, programmer, projects founder

Sometimes flake8 just won't shut up — and you're on a roll.

You're halfway through refactoring something ugly, and you know the linter will scream.
But you're not ready to fix every line just yet.
Or maybe the hook is buggy.
Or maybe you're just pushing to a personal branch and need to move fast.

The lazy (and dangerous) way is to skip all pre-commit hooks using --no-verify.
But there's a smarter way: selectively skip only the annoying one, like flake8.


✅ TL;DR

TaskCommand
Skip one hookSKIP=flake8 git commit -m "skip flake8"
Skip multiple hooksSKIP=flake8,mypy git commit -m "skip linting and type checking"
Skip everything (not recommended)git commit --no-verify
Find hook IDsCheck the id: in .pre-commit-config.yaml

🎯 What Is This About?

If you're using pre-commit to manage your Git hooks (you probably should be), you’ve got a bunch of automated checks running every time you commit.

These might include:

  • flake8 (Python linting)
  • black (code formatter)
  • mypy (type checker)
  • isort (import sorter)
  • trailing-whitespace, end-of-file-fixer, detect-private-key, etc.

That’s awesome — until one of them gets in the way.

Maybe flake8 is failing because you’re in the middle of refactoring and haven’t cleaned everything up yet.
Maybe mypy is being too strict on a temp hack.
Maybe you’re committing a quick fix at 3AM and can’t be bothered.

In that case, don’t kill all your hooks — just skip the one you need to skip.


🔥 Skip a Single Hook (Example: flake8)

SKIP=flake8 git commit -m "wip: skip flake8"