vibe clean
The clean command removes the current worktree and returns you to the main repository.
vibe cleanBehavior
Section titled “Behavior”Safety Checks
Section titled “Safety Checks”Before removing a worktree, vibe clean:
- Checks for uncommitted changes
- Prompts for confirmation if changes exist
- Runs pre-clean hooks
- Removes the worktree
- Runs post-clean hooks
- Changes directory to the main repository
Uncommitted Changes Warning
Section titled “Uncommitted Changes Warning”$ vibe cleanYou have uncommitted changes. Are you sure you want to clean? (y/N)If you have uncommitted changes, vibe will:
- Show a warning
- Ask for confirmation
- Only proceed if you explicitly confirm
The clean command supports hooks for cleanup tasks:
[hooks]pre_clean = ["git stash"]post_clean = ["echo 'Cleanup complete'"]| Hook | When | Working Directory |
|---|---|---|
pre_clean | Before worktree removal | Current worktree |
post_clean | After worktree removal | Main repository |
Pre-clean Hook Example
Section titled “Pre-clean Hook Example”Save your work before cleaning:
[hooks]pre_clean = [ "git stash --include-untracked", "echo 'Changes stashed'"]Post-clean Hook Example
Section titled “Post-clean Hook Example”Clean up shared resources:
[hooks]post_clean = [ "docker-compose down", "echo 'Cleanup complete'"]Workflow
Section titled “Workflow”worktree (current) │ ├── pre_clean hooks run │ ├── git worktree remove │ ├── post_clean hooks run │ └── cd to main repository │ ▼main repository (new current)