A pre-commit hook that lints and tests is great, until you just want to save a work-in-progress commit before switching branches. Git has a way around it for one commit.
git commit --no-verify -m "WIP: half done export"
--no-verify, or -n for short, makes git skip the pre-commit and commit-msg hooks for this commit. Other hooks, like post-commit, still run. git push has the same option for the pre-push hook.
I’d use it for commits you’ll squash or rewrite later anyway. A WIP commit before a quick switch, or a commit on a branch you’re about to rebase. When the real version goes in, the hooks get their turn.
It’s also handy when a hook is broken, for example a linter that crashes after an update, and you need to commit the fix for that same hook.
Skipping hooks doesn’t skip the checks on the server. If your CI runs the same lint and tests, a commit made with -n still fails there, just later and in public. And don’t make it a habit or an alias. Once the hooks are skipped by default, they protect nothing, and the first time you notice is when broken code is already pushed.
Further reading: git-commit documentation, githooks documentation