A shell tool to manage Git worktrees within your repository. Worktrees are created under .worktrees/ in the repo root, and the .claude directory is automatically copied into each new worktree.
curl -fsSL https://raw.githubusercontent.com/peterargue/worktree/main/install.sh | shor install from source
git clone https://github.com/peterargue/worktree.git ~/.local/share/worktree-manager
~/.local/share/worktree-manager/setup.shsource ~/.zshrc # or ~/.bashrcCreates a new worktree at .worktrees/<branch> and cds into it.
worktree add feature-login- If the branch exists locally or on the remote, it checks it out
- If the branch doesn't exist, it creates one from the default branch (main/master)
- Copies the
.claude/directory from the main repo into the worktree - Ensures
.worktrees/is listed in.gitignore - If the worktree already exists, just
cds into it
Branch names are sanitized for directory names — characters like /, ., @ are replaced with -. For example, feature/login.v2 becomes .worktrees/feature-login-v2.
To create a worktree from a specific base (tag, commit, or another branch), create the branch first:
git checkout -b hotfix-branch v1.2.0
worktree add hotfix-branchLists all worktrees (excluding the main repo), showing branch name and path.
worktree listSwitch to an existing worktree. With a branch name, cds directly into it. Without arguments, shows a numbered list to pick from.
worktree resume feature-login # cd directly
worktree resume # pick from a listRemoves a worktree. If the branch has been merged, the branch is also deleted.
worktree remove feature-loginUse --force to remove even if there are uncommitted changes:
worktree remove --force feature-loginyour-repo/
├── .worktrees/ # ignored by git
│ ├── feature-login/
│ ├── bugfix-123/
│ └── hotfix-release/
├── .gitignore # .worktrees/ added automatically
└── ...
- Git 2.5+ (for worktree support)
- Bash or Zsh