A bash tool that creates git worktrees with environment files and settings automatically copied over. Designed for use with Claude Code's multi-worktree workflow.
- Creates a new git worktree as a sibling directory (
../<repo>-wt<N>, auto-numbered) - Copies gitignored
.env*files from repo root andpackages/*/(monorepo support) - Copies
.claude/settings.local.jsonif present - Auto-detects and runs the appropriate package manager install (
pnpm>yarn>npm) cds into the worktree and launchesclaude(default behavior)
Copy the create-wt script to somewhere on your PATH:
cp create-wt /usr/local/bin/Or clone and symlink:
git clone https://github.com/kurotch321/create-worktree.git
ln -s "$(pwd)/create-worktree/create-wt" /usr/local/bin/create-wtcreate-wt <branch> # branch from HEAD, then cd + claude
create-wt <branch> --base <base-ref> # branch from specific ref, then cd + claude
create-wt <branch> --create-only # create worktree only (no cd/claude)# Start working on a feature branch in a new worktree
create-wt feat/123-new-api
# Branch from staging instead of HEAD
create-wt feat/123-new-api --base staging
# Just create the worktree without launching claude
create-wt feat/fix-bug --create-only| Option | Description |
|---|---|
<branch> |
Branch name to create (required) |
--base <ref> |
Base branch/commit to create from (default: HEAD) |
--create-only |
Create worktree only, skip cd and claude launch |
-h, --help |
Show help |
The script must be run from inside a git repository. It will:
- Find the repo root via
git rev-parse --show-toplevel - Create a worktree at
../<repo-name>-wt<N>(auto-increments N to avoid collisions) - If the branch already exists, check it out; otherwise, create it from
--base(default:HEAD) - Copy any
.env*files that are gitignored (checked viagit check-ignore -q) - For monorepos, also copy
.env*files frompackages/*/ - Copy
.claude/settings.local.jsonif it exists - Run the detected package manager's install command (
pnpm install --frozen-lockfile,yarn install --frozen-lockfile, ornpm ci) cdinto the worktree and launchclaude(unless--create-onlyis set)
- Bash
- Git
- Claude Code (for the auto-launch feature)