remove Command
What It’s For
Section titled “What It’s For”Clean up feature branches and worktrees when work is done or abandoned.
What It Does
Section titled “What It Does”- Removes matching worktree directories from the workspace.
- Can also delete corresponding Git branches.
- Supports safety checks for dirty worktrees and optional force behavior.
arashi remove [target] [options]Key Options
Section titled “Key Options”--no-check-dirtyskip uncommitted changes checks.--keep-worktreesdelete branches but keep worktree directories.--keep-branchesremove worktrees but keep branches.-f, --forceskip confirmation prompts.--dry-runpreview planned removals without changing worktrees, branches, or lifecycle hooks.--pathtreattargetas a worktree path.--jsonoutput machine-readable results.
Examples
Section titled “Examples”# Remove a branch across managed repositoriesarashi remove feature-login
# Interactive selection modearashi remove
# Remove by patharashi remove ./repos/api/feature-login --path
# Preview the removal plan without changing files or branchesarashi remove feature-login --dry-run
# Emit a machine-readable non-mutating plan for agents and scriptsarashi remove feature-login --dry-run --json
# Remove non-interactively and emit JSONarashi remove feature-login --force --json- Main worktrees are skipped automatically.
- If both
--keep-worktreesand--keep-branchesare set, no operation is performed. - Dirty worktrees require explicit confirmation unless
--no-check-dirtyis used. --dry-runsuppresses confirmation prompts and reports the planned worktree removals, branch deletions, dirty-worktree blockers, skipped main worktrees, missing branches, and configured remove hooks without mutating anything.arashi remove --dry-run --jsonreturns a single JSON envelope whosedataincludesdryRun: true, pending operations, effective options, blockers, and hook previews for automation.- Stale Git-prunable worktree records are excluded from
remove; usearashi pruneto clean stale metadata. - JSON mode does not prompt; pass explicit safety flags such as
--forceor--no-check-dirtywhen appropriate.
Agent Notes
Section titled “Agent Notes”- Treat
removeas destructive: confirm the target branch/worktree and inspectarashi statusbefore running it. - Prefer
arashi remove <branch> --force --jsononly 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.
Lifecycle Hooks
Section titled “Lifecycle Hooks”remove supports scoped pre-remove.sh and post-remove.sh hooks.
Hook discovery order for each targeted repository:
repos/<repo>/.arashi/hooks/<lifecycle>.sh.arashi/hooks/<lifecycle>.sh~/.arashi/hooks/<repo>/<lifecycle>.sh~/.arashi/hooks/<lifecycle>.sh
Behavior:
- Any failing
pre-removehook aborts destructive remove actions. - Dry-run mode reports hooks that would be considered but never executes
pre-removeorpost-removescripts. post-removehooks still run after partial remove failures.- Any failing
post-removehook returns a non-zero command exit status. - Hooks receive scope metadata via
ARASHI_HOOK_SCOPEandARASHI_HOOK_SOURCE_PATH.
Related Commands
Section titled “Related Commands”remove supports standalone repository worktrees and applicable user-global hooks, but configless local .arashi/hooks are inactive. See the Standalone Repository workflow.