this post was submitted on 27 Dec 2025
18 points (87.5% liked)
Git
4059 readers
2 users here now
Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.
Resources
Rules
- Follow programming.dev rules
- Be excellent to each other, no hostility towards users for any reason
- No spam of tools/companies/advertisements. Itβs OK to post your own stuff part of the time, but the primary use of the community should not be self-promotion.
Git Logo by Jason Long is licensed under the Creative Commons Attribution 3.0 Unported License.
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Everytine I've seen a pre-commit hook in my job, it was something that should have been in integration pipeline.
You should not run linter, test or any static analysis tool in a pre-commit (I'm looking at you husky π‘). Why ? Because:
It takes time. A commit should be instantaneous.
It may change the content of the commit or of the repos without explicite action of the developer.
The developper's branch is the developper's mess. He don't have to respect any convention, any quality gate or any workflow on its branch. Quality gates should happen only when integrating into trunk.
I always commit and push on Friday afternoon before leaving as "WIP", in case my computer crash during week end. I don't want to address issues of a WIP job. I just want to backup my work.
I may commit several time per minute, and do a rebase latter. I don't want to spend 2min each time waiting for eslint to parse the repos. I don't want to fix styling because I now I will fix it later and rebase -i before pushing.
You can use custom pre-commit in your own workflow, but forcing all developer to have the same pre-commit is a bad idea.
Amen. I also need to be able to commit WIP quickly if i need to urgently checkout master, or push my code because my laptop battery is about to die and i dont want it to have the only copy of my work.
There are ways to skip the hooks.