logoalt Hacker News

JoshTriplettyesterday at 5:32 PM4 repliesview on HN

I think there's value in git hooks, but pre-commit is the wrong hook. This belongs in a hook that runs on attempted push, not on commit.


Replies

fortuitous-frogyesterday at 5:38 PM

There's a config option for that :) https://prek.j178.dev/configuration/#default_install_hook_ty...

Marsymarsyesterday at 9:42 PM

"pre-commit the tool" supports the pre-push hook (as well as the various other hooks).

anttihaapalayesterday at 6:12 PM

formatting should definitely be in pre-commit though, otherwise you'll destroy diffs.

esafakyesterday at 5:36 PM

Run the light ones on commit, the heavy ones on push.