Preview worktree branches from your main checkout while safely stashing your working state.
Project description
⚡ flash
Preview worktree branches from your main checkout while seamlessly stashing your working state.
Why
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.
Install
uv tool install worktree-flash # or pipx install worktree-flash
Or from source:
git clone https://github.com/WillTwait/flash.git
uv tool install ./flash
For development (changes reflected immediately):
git clone https://github.com/WillTwait/flash.git
cd flash
uv run flash # runs from source, no install step
Add a shell alias for convenience: alias flash="uv run --project ~/path/to/flash flash"
Requires Python 3.10+.
Commands
| Command | Alias | Description |
|---|---|---|
flash into [name] |
flash i |
Switch to a worktree's branch (or open fzf picker) |
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 |
Typical workflow
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 up
Details
flash 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
Usage with Claude Code
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.
Safety
| 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 |
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file worktree_flash-0.2.1.tar.gz.
File metadata
- Download URL: worktree_flash-0.2.1.tar.gz
- Upload date:
- Size: 305.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
80046ba374e8a99e10f05dd5b014ce32ab8b4e20695ee0f80e789d95a31e6e26
|
|
| MD5 |
4371532d9a8f6d00beda38f5e44f0aed
|
|
| BLAKE2b-256 |
0f0cd33efdf00a4c8df84b947b9f676569ec2e11c2b80cc0c2f114342c5628cc
|
Provenance
The following attestation bundles were made for worktree_flash-0.2.1.tar.gz:
Publisher:
publish.yml on WillTwait/flash
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
worktree_flash-0.2.1.tar.gz -
Subject digest:
80046ba374e8a99e10f05dd5b014ce32ab8b4e20695ee0f80e789d95a31e6e26 - Sigstore transparency entry: 1189215235
- Sigstore integration time:
-
Permalink:
WillTwait/flash@77e2ef35a13c95e56821cbf029991008f7ba7b7b -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/WillTwait
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@77e2ef35a13c95e56821cbf029991008f7ba7b7b -
Trigger Event:
release
-
Statement type:
File details
Details for the file worktree_flash-0.2.1-py3-none-any.whl.
File metadata
- Download URL: worktree_flash-0.2.1-py3-none-any.whl
- Upload date:
- Size: 14.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
547c66c68cf213fe4564a868e4bb70b6eb46167ab45329ed0f715310db2b8ed1
|
|
| MD5 |
3e780a1fd8900da02b1b632ec9d1f281
|
|
| BLAKE2b-256 |
5e337327248adf590c5a13824d5fe424f95628ef858bc695436ea1cc88cb048e
|
Provenance
The following attestation bundles were made for worktree_flash-0.2.1-py3-none-any.whl:
Publisher:
publish.yml on WillTwait/flash
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
worktree_flash-0.2.1-py3-none-any.whl -
Subject digest:
547c66c68cf213fe4564a868e4bb70b6eb46167ab45329ed0f715310db2b8ed1 - Sigstore transparency entry: 1189215237
- Sigstore integration time:
-
Permalink:
WillTwait/flash@77e2ef35a13c95e56821cbf029991008f7ba7b7b -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/WillTwait
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@77e2ef35a13c95e56821cbf029991008f7ba7b7b -
Trigger Event:
release
-
Statement type: