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.
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
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
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
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
Videos
15:16
Boost Your Coding Efficiency with Git Pre-Commit Hooks - YouTube
29:33
Complete guide to GitHooks - Creating your own pre-commit hooks ...
10:38
Boost Your Git Workflow with Pre-Commit Hooks | Wahl Network - YouTube
14:09
does git 2.54 make pre-commit obsolete? - YouTube
29:19
Pre Commit Hooks EXPLAINED | Easy Way Clean Repo! GitHub & PyCharm ...
06:51
Git Pre-commit Hooks: Boost Code Quality & Consistency! 🚀 - YouTube
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.
Reddit
reddit.com › r/experienceddevs › what are your pre-commit hooks?
r/ExperiencedDevs on Reddit: What are your pre-commit hooks?
June 8, 2023 -
Hi folks!
I'm curious to know what pre-commit hooks you're using.
I start with linters and formatters.
Top answer 1 of 46
208
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.
2 of 46
183
No pre commit hooks at all. Linting and formatting checks are in the CI, and all projects have a VSCode devcontainer with enabled auto formatting but we don’t have pre commit hooks.
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.
GitHub
github.com › pre-commit › pre-commit
GitHub - pre-commit/pre-commit: A framework for managing and maintaining multi-language pre-commit hooks. · GitHub
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.
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...
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 › @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.
Reddit
reddit.com › r/python › what are your favourite pre-commit hooks and why?
r/Python on Reddit: What are your favourite pre-commit hooks and why?
April 24, 2024 -
Just getting started with pre-commit and I think it's awesome. Looking to find out what other code automation tools people are using. Let me know what works for you and why. Thanks!
Top answer 1 of 24
65
black Particularly useful on projects with multiple collaborators because everyone’s code will be formatted identically.
2 of 24
53
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
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).