I've found precommit hooks to be pretty clunky. A precommit hook failing comes at an awkward time and interrupts my train of thought for making a commit. I've also found that managing the tools and config for them is pretty annoying, either manually or with pre-commit . Instead, I have my editor run formatters/linters/etc and add checks for them in CI. Format-on-save is just the way to go. Answer from tikhonjelvis on reddit.com
🌐
pre-commit
pre-commit.com
pre-commit
It is a multi-language package manager for pre-commit hooks. You specify a list of hooks you want and pre-commit manages the installation and execution of any hook written in any language before every commit. pre-commit is specifically designed to not require root access.
🌐
Git
git-scm.com › book › en › v2 › Customizing-Git-Git-Hooks
Git - Git Hooks
The pre-commit hook is run first, before you even type in a commit message. It’s used to inspect the snapshot that’s about to be committed, to see if you’ve forgotten something, to make sure tests run, or to examine whatever you need to inspect in the code.
Discussions

What are your pre-commit hooks?
Please read our latest update. https://www.reddit.com/r/ExperiencedDevs/comments/142pwq9/sub_blackout_and_new_platform/ I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns. More on reddit.com
🌐 r/ExperiencedDevs
118
87
June 8, 2023
Discussion of the Benefits and Drawbacks of the Git Pre-Commit Hook
Note that you can skip hooks by passing the --no-verify flag to subcommands. Comes in handy when they're slow and you know that you've just fixed the wrong formatting that the previous invocation of your pre-commit hook complained about · This is what we have in our hooks: More on news.ycombinator.com
🌐 news.ycombinator.com
42
40
October 23, 2025
What are your favourite pre-commit hooks and why?
You may fancy me mad, but this is my standard python pre-commit stack: end-of-file-fixer trailing-whitespace fix-byte-order-marker mixed-line-ending name-tests-test no-commit-to-branch autoflake args: [ "--in-place", "--remove-unused-variables", "--remove-all-unused-imports" ] isort black cspell doc8 args: [ "--max-line-length", "112", "--file-encoding", "utf-8" ] flake8 additional_dependencies: [ flake8-pytest-style, flake8-bugbear, flake8-comprehensions, flake8-print, darglint ] bandit pylint More on reddit.com
🌐 r/Python
83
120
April 24, 2024
Unit tests run - Should it be included as a pre-push githook?
Devs can bypass this by deleting the git hook in the .git/hooks directory. Also, needs a 1-time setup to create the symlink of the script since files are not being tracked inside .git This being the case, you can't guarantee that your unit tests will run. A CI/CD pipeline will include unit testing (as applicable), and can be guaranteed to run at some point within the release process. Another problem is that requiring testing on push means that your devs are less likely to push their code unless/until it'll pass the tests. Result: either they'll start faking the test suite, or they won't push their branches as often. You want testing to get done before the code gets outside of their dev env, but not necessarily before. You want their tests, and the results of their tests to be visible to more than just them. If you have pending jobs on the CI/CD pipeline, scale the pipeline up. Don't cover the problem with your pipeline scaling by trying to move the unit tests back to a branch-level push. More on reddit.com
🌐 r/devops
24
13
May 2, 2022
🌐
GitHub
github.com › pre-commit › pre-commit-hooks
GitHub - pre-commit/pre-commit-hooks: Some out-of-the-box hooks for pre-commit · GitHub
Sort the lines in specified files (defaults to alphabetical). You must provide the target files as input. Note that this hook WILL remove blank lines and does NOT respect any comments. All newlines will be converted to line feeds (\n). ... Prevent addition of new git submodules.
Starred by 6.5K users
Forked by 789 users
Languages   Python
🌐
Switowski
switowski.com › blog › pre-commit-vs-ci
pre-commit vs. CI
November 28, 2023 - So instead of blocking the creation of a commit, we can create a commit, let some checks run in the terminal, but at the same time move on to working on the next task. Luckily, we don't have to write those git hooks by hand, since pre-commit also supports other git hooks out of the box, including the post-commit one.
🌐
Prettier
prettier.io › docs › precommit
Pre-commit Hook · Prettier
This will install husky and lint-staged, then add a configuration to the project’s package.json that will automatically format supported files in a pre-commit hook.
Find elsewhere
🌐
GitHub
github.com › pre-commit › pre-commit
GitHub - pre-commit/pre-commit: A framework for managing and maintaining multi-language pre-commit hooks. · GitHub
A framework for managing and maintaining multi-language pre-commit hooks. - pre-commit/pre-commit
Starred by 15.2K users
Forked by 963 users
Languages   Python 97.4% | R 2.0% | Shell 0.5% | Dockerfile 0.1% | Lua 0.0% | Ruby 0.0%
🌐
Cam
guidebook.devops.uis.cam.ac.uk › howtos › development › setup-pre-commit-hooks
Set up pre-commit hooks on a project - DevOps Division Guidebook
We add pre-commit hooks in order to run various linting and auto-formatting tools over the source before they are committed and pushed to GitLab.
🌐
Interrupt
interrupt.memfault.com › blog › pre-commit
Automatically format and lint code with pre-commit | Interrupt
October 27, 2021 - See pre-commit --help for information on running the tool. A useful command is pre-commit autoupdate, which will update all the checks to the latest tag! ... This file selects the hooks to be installed + used, and contains other configuration values such as paths to exclude from linting, etc.
🌐
DEV Community
dev.to › afl_ext › are-pre-commit-git-hooks-a-good-idea-i-dont-think-so-38j6
Are pre-commit git hooks a good idea? I don't think so. - DEV Community
December 17, 2023 - You seem to be confusing commits and pushes with merges to the main branches. With properly set up repository you will not be able to merge a pull request until CICD passes, so what's the point in running it locally? It is also not much faster, because the pipeline will run anyway, so you end up running it 2 times, locally and on CICD. You will not end up with bad code merged into main branch if you disable precommit hooks.
🌐
Medium
vjnvisakh.medium.com › setting-up-pre-commit-hooks-using-husky-a84888a2667a
Setting up Pre-Commit Hooks using Husky | by Visakh Vijayan | Medium
July 18, 2024 - This adds a folder into your root with the name husky Inside this you will be able to find a file called pre-commit You can add other files too.
🌐
Lizard Global
lizard.global › en › blog › what-are-git-hooks-how-do-you-do-a-pre-commit-hook
What Are Git Hooks? How Do You Do a Pre-commit Hook?
October 24, 2023 - Server-Side Hooks: pre-receive, update, and post-receive · While server-side hooks allow you to respond to different git push stages, client-side hooks (also known as local hooks) allow you to plug into the full commit life cycle. Furthermore, post-hooks are solely utilized for notifications, but pre-hooks allow you to change the action that is going to happen.
🌐
Poetry
python-poetry.org › docs › pre-commit-hooks
pre-commit hooks | Documentation | Poetry - Python dependency management and packaging made easy
pre-commit hooks pre-commit is a framework for building and running git hooks. See the official documentation for more information: pre-commit.com This document provides a list of available pre-commit hooks provided by Poetry. Note If you specify the args: for a hook in your .pre-commit-co...
🌐
Medium
gatlenculp.medium.com › effortless-code-quality-the-ultimate-pre-commit-hooks-guide-for-2025-57ca501d9835
Effortless Code Quality: The Ultimate Pre-Commit Hooks Guide for 2025
February 9, 2025 - During this journey, I fell in love with pre-commit hooks — simplicity, power, and a wonderful “set-it-and-forget-it” quality. Unlike heavier solutions like GitHub Actions, pre-commit hooks integrate seamlessly into daily development while remaining lightweight.
🌐
Hacker News
news.ycombinator.com › item
Discussion of the Benefits and Drawbacks of the Git Pre-Commit Hook | Hacker News
October 23, 2025 - Note that you can skip hooks by passing the --no-verify flag to subcommands. Comes in handy when they're slow and you know that you've just fixed the wrong formatting that the previous invocation of your pre-commit hook complained about · This is what we have in our hooks:
🌐
The Quality Duck
thequalityduck.co.uk › home › engineering › development practices › pre-commit hooks – how to use gits gift for quality code
Pre-commit Hooks – How To Use Gits Gift For Quality Code -
December 28, 2025 - Below I will cover off setting it up manually, and using Husky or Left-Hook. If you are comfortable writing Bash scripts, then setting up a pre-commit hook manually is simple. In your .git/hooks folder, create a new file called pre-commit and write a bash script in here.
🌐
Medium
medium.com › @muazzem.mamun › installing-pre-commit-hooks-in-your-github-repository-051b7514eb4b
Installing Pre-Commit Hooks in Your GitHub Repository | by Muazzem Mamun | Medium
November 11, 2023 - Installing Pre-Commit Hooks in Your GitHub Repository Overview This repository is configured with pre-commit hooks to help you maintain code quality by running checks before each commit. This …
🌐
Medium
medium.com › @sbarnea › embracing-pre-commit-hooks-4ef1f4e72914
Embracing pre-commit hooks. A newer version of this article is… | by Sorin Ionuț Sbârnea | Medium
August 1, 2019 - If you want to avoid surprised where local run give different results than running on ci, you better call pre-commit from inside tox. You should migrate your linters from test-requirements.txt to .pre-commit-hooks.yaml and specify only “pre-commit” as a test requirement.
🌐
Stefanie Molin
stefaniemolin.com › articles › devx › pre-commit › hook-creation-guide
Pre-Commit Hook Creation Guide | Stefanie Molin
September 1, 2025 - This is the recipe I teach in my pre-commit workshop, and it is based on my experience building two publicly-available hooks: numpydoc-validation (which checks that docstrings follow the numpydoc style guide) and exif-stripper (which strips out any EXIF metadata from images added to version control).