wt snapshot
Capture local dev overrides (patch + env files) into ~/.worktree-overlays for reuse across worktrees.
Synopsis
Description
wt snapshot captures your main clone's uncommitted local hacks into ~/.worktree-overlays/<repo>/ so every future worktree can re-apply them automatically.
It writes two things:
local.patch— output ofgit diff HEADfrom the main worktree (all tracked-file edits)- copies of untracked env files matching
[env].patterns, minus anything in[env].exclude
Run this from your MAIN worktree with only local dev hacks in the working tree. Any uncommitted feature work will end up in the patch too — commit or stash it first.
Examples
Where the overlay is applied
Every wt add and wt setup runs the overlay apply step between env setup and post_setup hooks. In a fresh worktree:
To toggle the behaviour per repo, use the [overlay] section of .worktreerc.
Safety
The overlay lives at ~/.worktree-overlays/<repo>/, outside any git tree. To block accidental commit or push of overlay lines to your remote, install the safety hooks:
Exit Codes
| Code | Meaning |
|---|---|
0 | Snapshot written successfully |
1 | Not in a git repository |