From 0fc39faa90f97db24043017a845f1754b4bb8b84 Mon Sep 17 00:00:00 2001 From: sommerfeld Date: Tue, 19 May 2026 16:50:52 +0100 Subject: feat(git): per-clone hook override at .git/hooks-local/ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds an untracked per-clone override layer to the hook dispatcher. Lookup order is now: 1. /hooks-local/ — untracked, per-clone, ignored by git 2. /.githooks/ — tracked, shared with teammates Use case: a shared repo ships a .githooks/pre-commit you want to locally replace without modifying the tracked file. Drop your hook in .git/hooks-local/ (chmod +x) and the dispatcher will run it instead — the global commit-msg trailer-strip and pre-push gate still run on top. If neither override exists, only the global user-level logic runs. --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'README.md') diff --git a/README.md b/README.md index 0a0c5f3..0ec6147 100644 --- a/README.md +++ b/README.md @@ -134,7 +134,12 @@ Verify with `sudo nft list ruleset`. ## Git hooks -The user-level hooks at `~/.config/git/hooks/` (set as `core.hooksPath` in `dot_config/git/config`) apply globally and auto-dispatch into any repo's `/.githooks/` if present — so projects can drop their own hooks at `.githooks/` without ever touching `core.hooksPath` or writing passthrough stubs. Per-event behavior: +The user-level hooks at `~/.config/git/hooks/` (set as `core.hooksPath` in `dot_config/git/config`) apply globally and auto-dispatch into the repo's hooks if present. Lookup order, first wins: + +1. `/hooks-local/` — untracked per-clone override. Use this to replace a tracked hook on a shared repo without affecting teammates. +2. `/.githooks/` — the project's tracked, shared hook. + +Projects opt in by just dropping a file at `.githooks/` — no `core.hooksPath` override, no passthrough stubs. Per-event behavior: - `pre-commit` → repo's `.githooks/pre-commit` (if any). No global logic. In this repo: `just check`. - `commit-msg` → repo's `.githooks/commit-msg` (if any), then strips any `Co-authored-by:` whose identity matches an AI agent (Copilot/Claude/Codex/…) so they don't trip the push gate. -- cgit v1.3.1