Skip to main content

Preview worktree branches from your main checkout while safely stashing your working state.

Project description

⚡ flash

Preview worktree branches from your main checkout while safely stashing your working state.

flash cli

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

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 status flash st Show current flash state

Typical workflow

flash workflow demo
flash into my-worktree    # stash, checkout worktree branch
# run server, test, poke around, fix things, commit
flash apply                # cherry-pick commits + sync files back to worktree
# keep testing
flash out                  # restore original branch, pop stash, clean up

Details

flash into — switch your checkout to a worktree's branch

  1. Stash uncommitted changes (tracked by SHA)
  2. Create and checkout a temp branch at the worktree's HEAD
  3. Copy the worktree's uncommitted changes into your checkout
  4. Write .flash/state.json to track everything

Pass a worktree name or branch, or omit for an fzf picker.

flash apply — send your changes back to the worktree

  1. Back up the worktree's state via git stash create
  2. Clean the worktree for a conflict-free cherry-pick
  3. Cherry-pick new commits into the worktree's history
  4. Copy uncommitted file changes to the worktree

Safe to run multiple times. If anything fails, the backup stash SHA is printed for recovery.

flash out — restore your original branch

  1. Prompt [a]pply / [d]iscard if you have unsent changes
  2. Checkout your original branch
  3. Delete the temp branch
  4. Pop your stash by SHA
  5. 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 commits + uncommitted changes to the worktree without ending the flash
- `flash status` — check current flash state

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

worktree_flash-0.1.0.tar.gz (262.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

worktree_flash-0.1.0-py3-none-any.whl (11.6 kB view details)

Uploaded Python 3

File details

Details for the file worktree_flash-0.1.0.tar.gz.

File metadata

  • Download URL: worktree_flash-0.1.0.tar.gz
  • Upload date:
  • Size: 262.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for worktree_flash-0.1.0.tar.gz
Algorithm Hash digest
SHA256 dee11923cef7785b3043346b3c015530eeddb16d831a51360d05afb04b03e056
MD5 679ef8d86d4ac139d9d08c356fc0a578
BLAKE2b-256 22629ad56b103bea692f50c43c50cb86d415fa12a0ad58d5f9fd04913a72ceb5

See more details on using hashes here.

Provenance

The following attestation bundles were made for worktree_flash-0.1.0.tar.gz:

Publisher: publish.yml on WillTwait/flash

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file worktree_flash-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: worktree_flash-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for worktree_flash-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6a012226f15e7f590d42fa68df418775c3b376cde56f1374ca8c0b062cb3e103
MD5 934903504f598d5dde603acf251191fe
BLAKE2b-256 67b6096b2b9ee79fd4dec5c6b2dbbc3ac30aac3477026e4af89f2d289abed8e2

See more details on using hashes here.

Provenance

The following attestation bundles were made for worktree_flash-0.1.0-py3-none-any.whl:

Publisher: publish.yml on WillTwait/flash

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page