frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Discussion of the Benefits and Drawbacks of the Git Pre-Commit Hook

https://yeldirium.de/2025/10/09/pre-commit-hooks/index.html
15•hambes•1w ago

Comments

ozzydave•3h ago
pre-commit hooks are awful, they get in the way of interactive rebasing. pre-push is where they belong; save a round-trip through CI.
esafak•2h ago
agents trip up over them too.
echelon•1h ago
Database integrity constraints fall into the same category.

This entire class of automation is awful and defeats the robustness of the tool itself.

All of these things have terribly unpredictable consequences and tend to fail at the worst moments, such as during a SEV.

You can encode the same rules and discipline in other ways that do not impact the health of the system, the quality of the data, or the ability of engineers to do work.

extr•1h ago
Yeah there's really no trouble with a pre-push hook that runs common/fast code checks. For TS projects I just run formatting, type, and lint checks. Faster feedback than spinning up a runner in CI and if I don't need it I just tack on --no-verify.
motorest•1m ago
> For TS projects I just run formatting, type, and lint checks.

For formatting I find that it's clearly preferable to lean on the IDE and apply the source code formatter at each file save, and apply it only to the file you are touching. Type checks should be performed right before running unit tests, for the same reason unit tests are executed.

hambes•49m ago
I would argue that if the pre-commit hooks come in the way of rebasing, either the commit hooks are doing way too much (which is one of the points of the article) or you are creating broken commits during rebasing. If any of the commits you are rebasing is e.g. breaking formatting rules, they shouldn't have been committed that way in the first place.
motorest•7m ago
> I would argue that if the pre-commit hooks come in the way of rebasing, either the commit hooks are doing way too much (which is one of the points of the article) or you are creating broken commits during rebasing.

I don't think your argument is grounded on reality. Applying whitespace changes does create merge conflicts, and if you have a hook that is designed to introduce said white changes at each commit of a rebase them you are going to have frequent merge conflicts.

Keep also in mind that minor changes such as renaming a variable can and will introduce line breaks. Thus even with a pristine codebase that was formatted to perfection you will get merge conflicts.

> If any of the commits you are rebasing is e.g. breaking formatting rules, they shouldn't have been committed that way in the first place.

You're letting the world know you have little to no programming experience.

jakub_g•9m ago
You can check inside the hook if you're in the middle of the rebase, and exit the hook early.

This is what we have in our hooks:

    if [ -d "$(git rev-parse --git-path rebase-merge)" ] || \
       [ -d "$(git rev-parse --git-path rebase-apply)" ] || \
       [ -f "$(git rev-parse --git-path MERGE_HEAD)" ]; then
        exit 0
    fi
fphilipe•1h ago
I'm of the opinion that Git hooks are personal. That's why they're not part of the source code itself. I make extensive use of hooks, but they're tailored to my needs.

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.

lemagedurage•41m ago
Pre commit hooks shine with fast formatters. Keep the hook under half a second or so and it's great.
0123456789ABCDE•27m ago
it's the tools. if they're slow people disable them or shift them right. you want your defect-detection and fixing to shift left

if you're not running auto-format on file-save, your auto-formatter is slow

if you're not running a code checker with auto-fix on pre-commit, your code checker is slow

if you're not running the test-suite on pre-push your tests are slow

if your tooling is slow you need to pick better tooling or make them fast

you want to keep that loop tight and active

Entire Linux Network stack diagram (2024)

https://zenodo.org/records/14179366
155•hhutw•2h ago•13 comments

Space Elevator

https://neal.fun/space-elevator/
52•kaonwarb•1h ago•2 comments

Introduction to reverse-engineering vintage synth firmware

https://ajxs.me/blog/Introduction_to_Reverse-Engineering_Vintage_Synth_Firmware.html
56•jmillikin•3h ago•3 comments

Novo Nordisk's Canadian Mistake

https://www.science.org/content/blog-post/novo-nordisk-s-canadian-mistake
321•jbm•9h ago•158 comments

Forth: The programming language that writes itself

https://ratfactor.com/forth/the_programming_language_that_writes_itself.html
116•suioir•5h ago•35 comments

Doing well in your courses: Andrej's advice for success (2013)

https://cs.stanford.edu/people/karpathy/advice.html
483•peterkshultz•13h ago•153 comments

Don't Force Your LLM to Write Terse [Q/Kdb] Code: An Information Theory Argument

https://medium.com/@gabiteodoru/dont-force-your-llm-to-write-terse-code-an-argument-from-informat...
23•gabiteodoru•6d ago•9 comments

Duke Nukem: Zero Hour N64 ROM Reverse-Engineering Project Hits 100%

https://github.com/Gillou68310/DukeNukemZeroHour
138•birdculture•9h ago•48 comments

Gleam OTP – Fault Tolerant Multicore Programs with Actors

https://github.com/gleam-lang/otp
93•TheWiggles•8h ago•32 comments

QuickDrawViewer: A Mac OS X utility to visualise QuickDraw (PICT) files

https://github.com/wiesmann/QuickDrawViewer
47•ibobev•6h ago•13 comments

Airliner hit by possible space debris

https://avbrief.com/united-max-hit-by-falling-object-at-36000-feet/
275•d_silin•12h ago•145 comments

Subway station study reveals fungal communities

https://phys.org/news/2025-09-subway-station-reveals-fungal-communities.html
6•PaulHoule•1w ago•0 comments

From Hollywood to horticulture: Cate Blanchett on a mission to save seeds

https://www.bbc.com/news/articles/cwy7ekl4yl8o
33•RickJWagner•6h ago•2 comments

Dosbian: Boot to DOSBox on Raspberry Pi

https://cmaiolino.wordpress.com/dosbian/
118•indigodaddy•11h ago•50 comments

Oskar Speck's 1932 Kayak Journey from Germany to Australia

https://nswskc.wordpress.com/2002/10/24/incredible-journey-50/
29•dividendpayee•1w ago•4 comments

Compare Single Board Computers

https://sbc.compare/
141•todsacerdoti•12h ago•55 comments

A Tiny Typo May Explain Centuries-Old Mystery Bout Chaucer's 'Canterbury Tales'

https://www.smithsonianmag.com/smart-news/a-tiny-typo-may-explain-a-centuries-old-mystery-about-c...
9•keepamovin•5d ago•2 comments

What's Behind the Mysterious Ancient Wall in the Gobi Desert?

https://news.artnet.com/art-world/the-hunt-gobi-wall-mongolia-2674588
41•derbOac•1w ago•25 comments

GNU Octave Meets JupyterLite: Compute Anywhere, Anytime

https://blog.jupyter.org/gnu-octave-meets-jupyterlite-compute-anywhere-anytime-8b033afbbcdc
125•bauta-steen•14h ago•36 comments

Look at how unhinged GPU box art was in the 2000s (2024)

https://www.xda-developers.com/absolutely-unhinged-gpu-box-art-from-the-early-2000s/
144•m-hodges•4h ago•46 comments

LoC Is a Dumb Metric for Functions

https://theaxolot.wordpress.com/2025/10/18/loc-is-a-dumb-metric-for-functions/
26•Axol•6h ago•29 comments

The Spilhaus Projection: A world map according to fish

https://southernwoodenboatsailing.com/news/the-spilhaus-projection-a-world-map-according-to-fish
116•zynovex•1w ago•14 comments

Comparing the power consumption of a 30 year old refrigerator to a new one

https://ounapuu.ee/posts/2025/10/14/fridge-power-consumption/
155•furkansahin•5d ago•182 comments

Nvidia has produced the first Blackwell wafer on US soil

https://www.xda-developers.com/nvidia-produced-first-blackwell-wafer-us-soil/
78•kristianp•4h ago•25 comments

Deterministic multithreading is hard (2024)

https://www.factorio.com/blog/post/fff-415
88•adtac•21h ago•9 comments

Pawn is a simple, typeless, 32-bit extension language with a C-like syntax

https://www.compuphase.com/pawn/pawn.htm
21•unleaded•1w ago•5 comments

Discussion of the Benefits and Drawbacks of the Git Pre-Commit Hook

https://yeldirium.de/2025/10/09/pre-commit-hooks/index.html
15•hambes•1w ago•11 comments

The Cancer Imaging Archive (TCIA)

https://www.cancerimagingarchive.net/
46•1970-01-01•6d ago•5 comments

Could the XZ backdoor been detected with better Git/Deb packaging practices?

https://optimizedbyotto.com/post/xz-backdoor-debian-git-detection/
91•ottoke•12h ago•73 comments

Show HN: Duck-UI – Browser-Based SQL IDE for DuckDB

https://demo.duckui.com
193•caioricciuti•19h ago•57 comments