drop
Create, list and delete git worktrees with drop, including the interactive delete TUIs (drop -d and drop -dc) and its layered config.
On this page
drop is Flow's worktree tool. It creates a git worktree on a fresh branch in one command, keeps every worktree it makes in one folder inside the repository, and cleans them up again from an interactive list that shows which ones are safe to delete. Flow uses the same code for new sessions on a fresh branch, for scheduled runs and for the Trash page, and ships drop as a command you can run yourself.
Install drop
drop is bundled with Flow. Put it on your PATH with Settings › Advanced › Command-line tools (or Install command-line tools… in the command palette), which links flow-cli, drop, ghx, gitx and sink into /usr/local/bin. A CLI tool page whose command starts with drop always runs the copy bundled with Flow, installed or not.
drop --help
drop --version
Create a worktree
drop # interactive: pick a repo and a fork source
drop new ~/src/app -y # non-interactive, with the defaults
drop --from origin/main --branch fix-login
drop --track feature-x # check an existing branch out directly
drop --detach v1.4.0 # a detached worktree at a ref
cd "$(drop -y --print-path)" # create one and cd into it
drop new is the default command, so drop [repo] [options] works too. Run bare drop in a terminal and it walks you through the choices; with -y, or with no terminal, it uses the defaults and asks nothing.
Which repository. --repo PATH or the first argument; else the repository you are in; else an interactive picker over your favorites (★), recent repositories (·) and the repositories one level under reposDir.
Where it goes. Each worktree is created at REPO/WORKTREE_DIR/BRANCH/REPO_NAME, with worktreeDir defaulting to .worktrees. drop adds that folder to the repository's .git/info/exclude, so it never shows up as untracked and no tracked file is edited.
The branch name. Unless you pass --branch, drop names the new branch PREFIXCITY-HASH: your branchPrefix, a city name not already used by another branch, and a random 5-character suffix (for example tw-padua-k3f9a). A prefix ending in / joins directly (h20/padua-k3f9a); any other prefix is joined with a single -.
Fork sources
| You want | Use |
|---|---|
| A new branch off the default branch | no flag: origin/DEFAULT fetched fresh, or the local default branch with --base local (or isolationBase: "local") |
| A new branch off a local branch | --from BRANCH, or pick it interactively |
| A new branch off a remote branch | --from origin/BRANCH |
| An existing branch checked out directly | --track BRANCH |
| A detached checkout at any ref | --detach REF |
New options
| Option | Meaning |
|---|---|
--repo PATH | The repository to spawn from (default: the current one, or the picker). |
--from REF | Fork a new branch off this ref (origin/main, main, feat-x). |
--branch NAME | The new branch's name (default: PREFIXCITY-HASH). |
--track BRANCH | Check the existing branch out; no new branch. |
--detach REF | Create a detached worktree pinned to the ref. |
--prefix P | Use this branch prefix for this run. |
--base origin|local | Where the default fork comes from: origin (fetched) or the local default branch. |
--worktree-dir DIR | Use this container folder for this run. |
--print-path | Print only the new worktree's path. |
--json | Machine-readable output. |
-y, --yes | Non-interactive: use the defaults, no prompts. |
List worktrees
drop ls # worktrees drop manages for the current repo
drop ls ~/src/app --json
Each line is the worktree's id, its branch (or detached@SHA) and its path. Only worktrees under the repository's worktreeDir are listed: the main checkout is not drop's.
Delete worktrees interactively
drop -d (or drop delete) opens a full-screen list of the worktrees drop manages. Inside a repository it covers that repository; run from anywhere else it sweeps your favorites, your recent repositories and the repositories under reposDir for worktrees.
Each row shows:
- the number of files with local changes,
- how far the branch is behind and ahead of the default branch (
↓2 ↑0), - the branch's GitHub pull request when the
ghCLI is available (#8 merged,#12 open), - and how long ago the worktree was last active.
| Key | Does |
|---|---|
␣ | Select or deselect the row |
a | Select all |
m | Add every "even" worktree (nothing unmerged: its HEAD is already in the default branch) |
s | Add every stale worktree (no local changes, no activity for the stale threshold) |
r | Refresh the list |
⏎ | Delete the selected worktrees |
q | Quit |
The list also refreshes itself every 10 minutes. Deleting removes each worktree and safely deletes its branch when the branch is merged. A worktree you select in the list is removed even with local changes, since you chose it.
Continuous mode
drop -dc (or drop -d --continuous) keeps the list open: after each deletion it prints what it deleted, then comes back to the list minus what was removed, re-scanning in the background, with a ✓ or ✗ notice in the header. Only q, Esc or Ctrl-C end it. It exits 0 when every deletion succeeded, 1 otherwise.
Tip: Flow's Trash page does the same job inside the app, across all your repositories. See Trash.
Delete without the list
| Option | Meaning |
|---|---|
--merged | Delete every even worktree, previewed per repository. |
--stale [DAYS] | Delete clean worktrees with no activity for DAYS days (default 5). |
--days N | The stale threshold the list's s key uses. |
--dry-run | Preview only; delete nothing. |
-y, --yes | Skip the confirmation prompt. |
--force | Force removal even when git refuses (a locked worktree, for example). |
--json | Headless JSON on stdout; never opens the list. Alone, a full status inventory; with --merged or --stale, a preview of the targets; add -y to delete and print the results. |
--merged and --stale never touch a worktree with local changes, or the worktree you are standing in.
drop -d --stale 14 --dry-run # what would go
drop -d --merged -y # delete every even worktree
drop -d --json # inventory for a script or agent
Remove specific worktrees
drop rm padua-k3f9a # by id
drop rm ~/src/app/.worktrees/x/app # or by path
drop rm a b c --json
drop rm takes one or more ids (from drop ls) or paths, and --repo PATH for another repository. A worktree with local changes needs --force, as with git worktree remove. An id that matches nothing is reported and the others still go. It exits 0 only when every target was removed. Bare drop rm in a terminal opens the delete list instead.
Configuration
drop reads three settings, from lowest to highest priority:
- built-in defaults
- your global file,
~/.config/drop/config.json - the repository's checked-in
.drop.json - your own per-repository file,
~/.flow/repo_config/REPO/drop.json - command-line flags
| Key | Default | Meaning |
|---|---|---|
worktreeDir | ".worktrees" | The folder, relative to the repository root, that holds drop's worktrees. |
branchPrefix | "" | The prefix of generated branch names, such as "tw-" or "h20/". |
isolationBase | "origin" | Where a new branch forks from without --from: "origin" (fetched fresh) or "local". |
Any of these files may carry an "!important" list that lifts its value above the usual order; see Settings scopes.
The global file also holds the picker's lists:
{
"worktreeDir": ".worktrees",
"branchPrefix": "tw-",
"isolationBase": "origin",
"reposDir": "/Users/you/src",
"favorites": ["/Users/you/src/app"],
"recents": [],
"repos": {
"/Users/you/src/legacy": { "branchPrefix": "h20/" }
}
}
| Key | Meaning |
|---|---|
reposDir | The folder scanned one level deep for repositories (default ~/src). |
favorites | Repositories pinned to the top of the picker. |
recents | The last 10 repositories you created a worktree in, newest first. drop keeps this list itself. |
repos | Per-repository overrides keyed by absolute path, applied on top of the global values. |
drop rewrites this file on every run, so keep it valid JSON.
The config command
drop config # the global file, and the effective settings for the current repo
drop config --json
drop config path # where the global file is
drop config favorite # favorite the current repo (or pass a path)
drop config unfavorite ~/src/app
Limits
- Pull request status in the delete list needs the
ghCLI. --mergedand--staleskip worktrees with local changes; select those in the list if you mean to delete them.- A corrupt
.drop.jsonis an error; a corrupt~/.flow/repo_config/REPO/drop.jsonis skipped with a warning.
Sources
Written from these files in the Flow app repo
src/bin/drop.rssrc/drop/mod.rssrc/drop/args.rssrc/drop/config.rssrc/drop/naming.rssrc/drop/gitignore.rssrc/drop/status.rssrc/drop/commands/new.rssrc/drop/commands/ls.rssrc/drop/commands/rm.rssrc/drop/commands/delete.rssrc/drop/commands/tui.rssrc/drop/commands/config.rssrc/cli_tools.rsdocs/settings-scopes.md