Skip to content

multiple-worktrees

worktree

primary worktree on main + 3 linked worktrees on feature/hotfix branches

A repository with multiple linked worktrees, each on a different
branch. The primary worktree is on `main` with a baseline commit.
Three linked worktrees exist at temp paths:
  - `feat/alpha` — one commit ahead of main
  - `feat/beta` — two commits ahead of main
  - `hotfix/urgent` — one commit ahead of main

Useful for testing:
  - worktree list views
  - branch switching when worktrees lock branches
  - tools that detect and display linked worktrees
  - the "branch is checked out in another worktree" error case
  • main is checked out in the primary worktree
  • 3 linked worktrees exist
  • feat/alpha has 1 commit ahead of main
  • feat/beta has 2 commits ahead of main
  • hotfix/urgent has 1 commit ahead of main
worktreebranch
feat/alphafeat/betahotfix/urgentmain
import { spinUpScenario } from '@gfargo/git-scenarios'

const repo = await spinUpScenario('multiple-worktrees')
* c4f2fe0 (hotfix/urgent) fix: critical hotfix
| * 9c01773 (feat/beta) feat: beta part 2
| * afd85cf feat: beta part 1
|/  
| * e586e91 (feat/alpha) feat: alpha feature
|/  
* f53cf2e (HEAD -> main) chore: initial scaffold

Back to Scenario Browser