remove Command
What It’s For
Clean up feature branches and worktrees when work is done or abandoned.
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.
Usage
arashi remove [target] [options]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.--pathtreattargetas a worktree path.--jsonoutput machine-readable results.
Examples
# Remove a branch across managed repositoriesarashi remove feature-login
# Interactive selection modearashi remove
# Remove by patharashi remove ./repos/api/feature-login --pathNotes
- 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.
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. 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.