Precommit Hooks Are Bad
Summary
TLDRIn this passionate rant, a developer argues strongly against the use of pre-commit hooks in Git workflows. The speaker insists that developers should have the freedom to work with Git in their preferred way without being hindered by mandatory hooks. They advocate for using CI pipelines to enforce code standards rather than imposing local restrictions. The speaker highlights that pre-commit hooks often disrupt productivity and suggests that the real problem lies in poorly set-up CI, not individual commit practices. Their solution? Turn off the hooks, build proper CI workflows, and let everyone be happier.
Takeaways
- 😀 Pre-commit hooks are seen as unnecessary and counterproductive in the context of git workflows.
- 😀 Developers should not be prescribed specific git workflows unless they have already pushed their code to a shared environment.
- 😀 The way a developer uses git on their machine should be their personal choice and should not be dictated by external rules.
- 😀 Enforcing rules for commit formatting or linting should be done on the server-side or through CI, not by pre-commit hooks.
- 😀 CI (Continuous Integration) systems are easier to set up now, and if pre-commit hooks are used instead, it can be seen as laziness.
- 😀 Pre-commit hooks may block developers' productivity and discourage future contributions.
- 😀 The speaker personally uses many commits while experimenting with code and prefers to manage them later, often squashing them as necessary.
- 😀 Complaints about commit structure should be addressed during the pull request process, not while the developer is working on their machine.
- 😀 Developers should not be blocked from using git the way they prefer, as long as the code meets requirements when it’s pushed to a repository.
- 😀 If CI is hard to implement or tooling is insufficient, it’s better to solve those issues rather than relying on pre-commit hooks.
- 😀 Pre-commit hooks are over-prescribed and are considered a poor solution to a problem that shouldn't even exist in the first place.
- 😀 In environments that use pre-commit hooks, the recommendation is to disable them and implement CI with GitHub Actions instead.
Q & A
Why does the speaker oppose the use of pre-commit hooks?
-The speaker believes pre-commit hooks restrict developers' freedom in managing their Git workflows, arguing that developers should be able to use Git in ways that suit their personal needs without interference.
What is the speaker's stance on enforcing commit rules?
-The speaker agrees that rules should be enforced, but they argue that commit rules should be checked on the server using Continuous Integration (CI) rather than being forced on developers through pre-commit hooks.
What does the speaker suggest as an alternative to pre-commit hooks?
-The speaker suggests using CI-based workflows to enforce commit rules, as it allows checks to be made on the server rather than on developers' local machines.
What are the speaker's views on developers' Git workflows?
-The speaker believes that the way a developer uses Git on their machine is their responsibility and should not be dictated by external tools or rules, as long as it doesn’t hinder the overall quality of the code.
How does the speaker personally use Git in their workflow?
-The speaker makes frequent commits during development, even when trying out ideas, and later revises or squashes them. They value flexibility and don’t want to be restricted by pre-commit hooks.
What problem does the speaker identify with enforcing rules through pre-commit hooks?
-The speaker argues that pre-commit hooks block developers' productivity by forcing them to follow rigid processes, which can slow down their work and reduce flexibility in their development process.
How does the speaker feel about CI tools in comparison to pre-commit hooks?
-The speaker believes CI tools are a better solution for enforcing commit rules because they operate on the server side, avoiding interference with the developer’s local workflow, and are easier to set up nowadays.
What does the speaker recommend for companies using pre-commit hooks?
-The speaker suggests that teams should disable pre-commit hooks and instead implement GitHub Actions or similar CI solutions to handle code checks, which would lead to a more efficient and developer-friendly workflow.
Why does the speaker believe pre-commit hooks are 'lazy'?
-The speaker feels pre-commit hooks are a lazy solution because they bypass the proper setup of CI tools, thus making the developer experience more difficult and less efficient instead of addressing the real problem with tooling.
What is the speaker’s view on the role of tooling in Git workflows?
-The speaker believes that if tooling issues prevent effective CI setup, teams should focus on fixing those issues rather than resorting to restrictive solutions like pre-commit hooks. Good tooling should support, not hinder, the development process.
Outlines
![plate](/images/example/outlines.png)
Этот раздел доступен только подписчикам платных тарифов. Пожалуйста, перейдите на платный тариф для доступа.
Перейти на платный тарифMindmap
![plate](/images/example/mindmap.png)
Этот раздел доступен только подписчикам платных тарифов. Пожалуйста, перейдите на платный тариф для доступа.
Перейти на платный тарифKeywords
![plate](/images/example/keywords.png)
Этот раздел доступен только подписчикам платных тарифов. Пожалуйста, перейдите на платный тариф для доступа.
Перейти на платный тарифHighlights
![plate](/images/example/highlights.png)
Этот раздел доступен только подписчикам платных тарифов. Пожалуйста, перейдите на платный тариф для доступа.
Перейти на платный тарифTranscripts
![plate](/images/example/transcripts.png)
Этот раздел доступен только подписчикам платных тарифов. Пожалуйста, перейдите на платный тариф для доступа.
Перейти на платный тарифПосмотреть больше похожих видео
![](https://i.ytimg.com/vi/IEgXJEkjBZ0/maxresdefault.jpg)
Automate Everything: How One Manifest Powers Your Entire DevOps Pipeline
![](https://i.ytimg.com/vi/ecK3EnyGD8o/hq720.jpg)
13 Advanced (but useful) Git Techniques and Shortcuts
![](https://i.ytimg.com/vi/uwmQgCrCh2s/maxresdefault.jpg?sqp=-oaymwEmCIAKENAF8quKqQMa8AEB-AH-CYAC0AWKAgwIABABGH8gVCgTMA8=&rs=AOn4CLAb0RiTiqZf8SDAPTtuODES6kdoyQ)
A Tale of two Kitchens, hyper modernizing your codebase - presented by Christian Ledermann
![](https://i.ytimg.com/vi/cR9K6THCxCw/hq720.jpg)
What are Custom Hooks When to Create One | Lecture 166 | React.JS 🔥
![](https://i.ytimg.com/vi/ALTmXm9eWGE/maxresdefault.jpg?sqp=-oaymwEmCIAKENAF8quKqQMa8AEB-AH-CYAC0AWKAgwIABABGEcgRSh_MA8=&rs=AOn4CLBPpRRKRUATY0Bq-EbRq7m_Zp6g3A)
IBM & Compuware: Mainframe DevOps Transformation Case Studies
![](https://i.ytimg.com/vi/42UP1fxi2SY/hq720.jpg)
CI/CD In 5 Minutes | Is It Worth The Hassle: Crash Course System Design #2
5.0 / 5 (0 votes)