Skip to content

remove Command

Clean up feature branches and worktrees when work is done or abandoned.

  • Removes matching worktree directories from the workspace.
  • Can also delete corresponding Git branches.
  • Supports safety checks for dirty worktrees and optional force behavior.
Terminal window
arashi remove [target] [options]
  • --no-check-dirty skip uncommitted changes checks.
  • --keep-worktrees delete branches but keep worktree directories.
  • --keep-branches remove worktrees but keep branches.
  • -f, --force skip confirmation prompts.
  • --path treat target as a worktree path.
  • --json output machine-readable results.
Terminal window
# Remove a branch across managed repositories
arashi remove feature-login
# Interactive selection mode
arashi remove
# Remove by path
arashi remove ./repos/api/feature-login --path
# Remove non-interactively and emit JSON
arashi remove feature-login --force --json
  • Main worktrees are skipped automatically.
  • If both --keep-worktrees and --keep-branches are set, no operation is performed.
  • Dirty worktrees require explicit confirmation unless --no-check-dirty is used.
  • JSON mode does not prompt; pass explicit safety flags such as --force or --no-check-dirty when appropriate.
  • Treat remove as destructive: confirm the target branch/worktree and inspect arashi status before running it.
  • Prefer arashi remove <branch> --force --json only after the user has asked for cleanup and the relevant work is merged or intentionally abandoned.
  • Do not bypass dirty checks unless the user explicitly accepts losing or preserving those changes another way.

remove supports scoped pre-remove.sh and post-remove.sh hooks.

Hook discovery order for each targeted repository:

  1. repos/<repo>/.arashi/hooks/<lifecycle>.sh
  2. .arashi/hooks/<lifecycle>.sh
  3. ~/.arashi/hooks/<repo>/<lifecycle>.sh
  4. ~/.arashi/hooks/<lifecycle>.sh

Behavior:

  • Any failing pre-remove hook aborts destructive remove actions.
  • post-remove hooks still run after partial remove failures.
  • Any failing post-remove hook returns a non-zero command exit status.
  • Hooks receive scope metadata via ARASHI_HOOK_SCOPE and ARASHI_HOOK_SOURCE_PATH.