Git 2.54 Has Config-Based Hooks

Git 2.54 lets you define hooks in your gitconfig instead of dropping scripts into .git/hooks/:

[hook "linter"]
    event = pre-commit
    command = ~/bin/lint

You can stack multiple hooks per event, flip them off with a boolean, and run git hook list to see what's wired up. The old "did everyone install the hooks?" problem mostly goes away when hooks live in git config includes.

It's not a pre-commit replacement. Pre-commit manages tool installation, virtualenvs, file filtering, all of that. Config hooks just call a command that's already on your machine. But for the universal stuff that doesn't need environment management? Blocking commits to protected branches, catching merge conflict markers, secret detection? Just put those in a shared gitconfig include and distribute it through your dotfiles. Done. No more copying a config file into every repo.

The other thing: if you have AI coding agents committing code (and you probably do at this point), hooks are one of the few guardrails that actually fire no matter what. The agent doesn't need to know about your conventions. It just can't commit code that doesn't pass.

Language-specific formatters and linters still belong in something like pre-commit that manages their installation. But the baseline of "every repo gets these checks for free" just got way easier to set up.