Overlay workflow
Persist local dev overrides across worktrees without ever committing them to git.
The problem
Working across worktrees usually needs the same local hacks in each: hardcoded localhost URLs, disabled prod-only code paths, feature-flag overrides. Committing them is dangerous; copying them by hand is tedious.
The solution
The overlay is your personal patch of local hacks, stored outside any git tree, re-applied to every new worktree automatically, and guarded by two safety hooks that refuse to let it reach the remote.
Storage layout (per repo):
One-time setup per repo
Optionally tune the [overlay] section in .worktreerc.
Daily flow
The overlay apply step runs in the setup pipeline between env setup and post_setup hooks. You'll see it in the output:
When your local hacks change
Edit them in your main clone, then re-snapshot:
Safety net
The pre-commit and pre-push hooks installed by wt install-safety-hooks refuse to let overlay lines reach the remote:
The wrapper preserves any pre-existing hook (pre-commit framework, husky, lint-staged) by moving it to <hook>.wt-original and delegating after the safety check passes. Both keep working.
Turning it off
Set enabled = false in .worktreerc:
The overlay apply step becomes a no-op. Existing captures under ~/.worktree-overlays/ are untouched.
Related commands
wt snapshot— capture local overrideswt install-safety-hooks— install the guards- Configuration
[overlay]— full config reference