Preview worktree branches from your main checkout while seamlessly stashing your working state.
Worktrees are great for parallelizing work, but your dev environment — backend servers, locally running frontend, etc — lives in your main checkout. When you need to test changes on a worktree, you're stuck doing a manual stash-checkout-test-restore dance, carefully tracking not to throw away diffs on either branch.
flash does the whole dance in one command and tracks every step so nothing gets lost.
Inspired by Conductor's Spotlight.
uv tool install worktree-flash # or pipx install worktree-flashOr from source:
git clone https://github.com/WillTwait/flash.git
uv tool install ./flashFor development (changes reflected immediately):
git clone https://github.com/WillTwait/flash.git
cd flash
uv run flash # runs from source, no install stepAdd a shell alias for convenience: alias flash="uv run --project ~/path/to/flash flash"
Requires Python 3.10+.
| Command | Alias | Description |
|---|---|---|
flash into [name] |
flash i |
Switch to a worktree's branch (or open fzf picker) |
flash into -n name |
Create a new worktree and flash into it | |
flash out |
flash o |
End flash, restore original branch + stash |
flash out --apply |
End flash, send changes to worktree first | |
flash out --discard |
End flash, throw away changes | |
flash apply |
flash a |
Send changes to worktree without ending flash |
flash sync |
flash s |
Pull worktree changes into canonical checkout |
flash diff |
flash d |
Show unapplied and unsynced changes |
flash diff -v |
Show full diff | |
flash status |
flash st |
Show current flash state |
flash update |
flash u |
Check for a newer version |
flash into my-worktree # stash, checkout worktree branch
# run server, test, poke around, fix things, commit
flash sync # pull latest worktree changes into canonical checkout
flash diff # see unapplied + unsynced changes
flash apply # cherry-pick commits + sync files back to worktree
# keep testing
flash diff -v # full diff of all changes
flash diff --incoming # only show unsynced worktree changes
flash out # restore original branch, pop stash, clean upflash into — switch your checkout to a worktree's branch
- Stash uncommitted changes (tracked by SHA)
- Create and checkout a temp branch at the worktree's HEAD
- Copy the worktree's uncommitted changes into your checkout
- Write
.flash/state.jsonto track everything
Pass a worktree name or branch, or omit for an fzf picker.
flash apply — send your changes back to the worktree
- Back up the worktree's state via
git stash create - Clean the worktree for a conflict-free cherry-pick
- Cherry-pick new commits into the worktree's history
- Copy uncommitted file changes to the worktree
Safe to run multiple times. If anything fails, the backup stash SHA is printed for recovery.
flash sync — pull worktree changes into the canonical checkout
- Diff uncommitted changes in the worktree against HEAD
- Copy changed files into the canonical checkout
Useful when you've made changes directly in the worktree (e.g. from another tool or editor) and want them reflected in your canonical checkout.
flash diff — show unapplied and unsynced changes
- Shows both directions: unapplied (what
applywould send) and unsynced (whatsyncwould pull) - Defaults to a diffstat summary; use
--verbose/-vfor the full diff - Use
--incoming/-ito show only unsynced worktree changes
flash out — restore your original branch
- Prompt
[a]pply / [d]iscardif you have unapplied changes (shows diffstat) - Checkout your original branch
- Delete the temp branch
- Pop your stash by SHA
- Remove
.flash/entirely
Add this to your project's CLAUDE.md so Claude understands how to use flash:
## Flash (worktree previewing)
`flash` is installed and available for previewing worktree branches from the main checkout.
- `flash into <name>` — switch to a worktree branch (stashes current work automatically)
- `flash out --discard` — restore original branch (use `--apply` to send changes back to worktree)
- `flash apply` — send unapplied changes to the worktree without ending the flash
- `flash sync` — pull unsynced worktree changes into the canonical checkout
- `flash diff` — show unapplied and unsynced changes (`-v` for full diff, `--incoming` for worktree only)
- `flash status` — check current flash state (shows unapplied/unsynced summary)
When you need to test or review code from a worktree, use `flash into` instead of manually
checking out branches. Always `flash out` when done.| Risk | Mitigation |
|---|---|
| Losing stashed changes | Tracked by SHA, not index position |
| Losing worktree state on apply | git stash create backup before any destructive op |
| Double flash | Refused if already flashed in |
| Branch conflict with worktree | Uses flash/<branch> temp branch |
| Interrupted mid-operation | State file has everything needed for manual recovery |
| Non-interactive (CI/agents) | Defaults to --discard with a warning |

