Skip to content

vibe clean

The clean command removes the current worktree and returns you to the main repository.

Terminal window
vibe clean

Before removing a worktree, vibe clean:

  1. Checks for uncommitted changes
  2. Prompts for confirmation if changes exist
  3. Runs pre-clean hooks
  4. Removes the worktree
  5. Runs post-clean hooks
  6. Changes directory to the main repository
$ vibe clean
You 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'"]
HookWhenWorking Directory
pre_cleanBefore worktree removalCurrent worktree
post_cleanAfter worktree removalMain repository

Save your work before cleaning:

[hooks]
pre_clean = [
"git stash --include-untracked",
"echo 'Changes stashed'"
]

Clean up shared resources:

[hooks]
post_clean = [
"docker-compose down",
"echo 'Cleanup complete'"
]
worktree (current)
├── pre_clean hooks run
├── git worktree remove
├── post_clean hooks run
└── cd to main repository
main repository (new current)
  • start - Create worktrees
  • Hooks - Configure cleanup hooks