Skip to content

deskhand down

Terminal window
deskhand down <branch|slug> [options]

Tear down a worktree environment, removing only what deskhand created.

Argument Description
branch|slug Required. Identifies the worktree via the registry.
Flag Description
--keep-branch Remove the worktree but leave the git branch in place.
--force Proceed without interactive confirmation.

down is destructive, so by default it asks for interactive confirmation. When input is non-interactive (no TTY — the normal case for AI agents and CI), it does not silently proceed: without --force it fails fast with an actionable message. Unattended callers should always pass --force.

  1. Look up the registry record. If none exists, down refuses to act destructively and says so — it never infers database names from the slug.
  2. Drop only the databases that record lists as deskhand-created. A shared (base project) database is never dropped.
  3. Remove the storage symlink as a link — never following it into its target.
  4. Remove the worktree and prune orphaned refs; remove the branch unless --keep-branch.
  5. Release allocated ports.
  6. Remove the registry entry (last, so an interrupted teardown is retryable).

See the Safety model for the guarantees behind teardown.