Skip to content

Hooks

Hooks allow you to run commands automatically during the worktree lifecycle.

HookWhenWorking Directory
pre_startBefore worktree creationOrigin repository
post_startAfter worktree creationNew worktree
pre_cleanBefore worktree removalCurrent worktree
post_cleanAfter worktree removalMain repository
[hooks]
pre_start = ["echo 'Preparing worktree...'"]
post_start = [
"pnpm install",
"pnpm db:migrate"
]
pre_clean = ["git stash"]
post_clean = ["echo 'Cleanup complete'"]

The following environment variables are available in all hook commands:

VariableDescription
VIBE_WORKTREE_PATHAbsolute path to the created worktree
VIBE_ORIGIN_PATHAbsolute path to the original repository
[hooks]
post_start = [
"echo 'Worktree created at: $VIBE_WORKTREE_PATH'",
"echo 'Origin repository: $VIBE_ORIGIN_PATH'"
]

vibe displays a real-time progress tree during hook execution:

✶ Setting up worktree feature/new-ui…
┗ ☒ Pre-start hooks
┗ ☒ npm install
☒ cargo build --release
⠋ Copying files
┗ ⠋ .env.local
☐ node_modules/
Situationstdoutstderr
Progress display activeSuppressedAlways shown
Progress display inactiveWritten to stderrAlways shown
Failed hooksN/AAlways shown

For vibe start:

  1. pre_start hooks run in origin repository
  2. Worktree is created
  3. Files/directories are copied
  4. post_start hooks run in new worktree

For vibe clean:

  1. pre_clean hooks run in current worktree
  2. Worktree is removed
  3. post_clean hooks run in main repository
[hooks]
post_start = [
"pnpm install",
"pnpm build"
]
pre_clean = ["git stash --include-untracked"]
[hooks]
post_start = [
"pnpm install",
"pnpm db:migrate",
"pnpm db:seed"
]
[hooks]
post_start = [
"docker-compose up -d",
"sleep 5",
"pnpm db:migrate"
]
pre_clean = ["docker-compose down"]

You can skip hooks with the --no-hooks option:

Terminal window
vibe start feat/quick-fix --no-hooks