diff options
| author | 2026-05-19 16:50:52 +0100 | |
|---|---|---|
| committer | 2026-05-19 16:50:52 +0100 | |
| commit | 0fc39faa90f97db24043017a845f1754b4bb8b84 (patch) | |
| tree | 066acfd99d41d2f4ebf0d3716ae5f28a06801aa5 /README.md | |
| parent | 67868f51bbab5bc3ef5c8ba15433ba401a297f1a (diff) | |
| download | dotfiles-0fc39faa90f97db24043017a845f1754b4bb8b84.tar.gz dotfiles-0fc39faa90f97db24043017a845f1754b4bb8b84.tar.bz2 dotfiles-0fc39faa90f97db24043017a845f1754b4bb8b84.zip | |
feat(git): per-clone hook override at .git/hooks-local/
Adds an untracked per-clone override layer to the hook dispatcher.
Lookup order is now:
1. <git-dir>/hooks-local/<name> — untracked, per-clone, ignored by git
2. <repo-top>/.githooks/<name> — 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/<name> (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.
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -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 `<repo>/.githooks/<hookname>` if present — so projects can drop their own hooks at `.githooks/<name>` 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. `<git-dir>/hooks-local/<name>` — untracked per-clone override. Use this to replace a tracked hook on a shared repo without affecting teammates. +2. `<repo-top>/.githooks/<name>` — the project's tracked, shared hook. + +Projects opt in by just dropping a file at `.githooks/<name>` — 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. |
