wt install-safety-hooks
Install pre-commit + pre-push hooks that block accidental commit/push of overlay lines.
Synopsis
Description
wt install-safety-hooks installs two git hooks that refuse commits or pushes whose diff contains lines present in ~/.worktree-overlays/<repo>/local.patch. It is the second half of the overlay workflow — the guard that keeps your local hacks from ever reaching the remote.
pre-commit— refuses when any line in the staged diff exactly matches an added line in the overlay patchpre-push— refuses when any commit being pushed introduces such a line
Both hooks preserve any pre-existing hook: the original is moved to <hook>.wt-original and the new wrapper execs it after the safety check passes. This means pre-commit frameworks (Python pre-commit, husky, lint-staged) keep running unchanged.
Re-running is idempotent — hooks with our marker (# wt-safety-hook v1) are overwritten in place, no .wt-original chain is grown.
Options
| Argument | Description |
|---|---|
[repo-path] | Target repository (default: current directory) |
Examples
What gets blocked
Bypass
git commit --no-verify / git push --no-verify skip the check. Use only when you understand what you're bypassing.
Uninstall
Exit Codes
| Code | Meaning |
|---|---|
0 | Hooks installed successfully |
1 | Not in a git repository |