git-worktree

Manages Git worktrees for isolated parallel development with automated environment file copying.

Updated Jan 23, 2026
One-click install
npx skills add https://github.com/stephschofield/beth --skill git-worktree-stephschofield
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: git-worktree
Source: https://github.com/stephschofield/beth/tree/main/.github/skills/git-worktree
Command: npx skills add https://github.com/stephschofield/beth --skill git-worktree-stephschofield

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve? Working on multiple branches or reviewing pull requests usually requires stashing changes or cloning the repository again, which disrupts your current work. This Skill manages Git worktrees so you can run isolated parallel development environments without touching your main checkout. ## Core Features & Use Cases - Worktree Lifecycle Management: Create, list, switch between, and clean up worktrees through a single interactive script with confirmation prompts. - Automatic Environment Setup: Copies .env, .env.local, and .env.test files from the main repository into each new worktree and keeps .worktrees in .gitignore. - Safe Cleanup: Interactively removes inactive worktrees while protecting the currently active one. - Use Case: While reviewing a pull request, create an isolated worktree with all environment variables in place, run the code, then clean up afterward without ever leaving your feature branch. ## Quick Start Ask the agent to create a new Git worktree for a branch named feature-login using the worktree manager script.

Frequently Asked Questions about git-worktree

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a Git worktree for parallel development?▼

Run the worktree-manager.sh script with the create command followed by a branch name, optionally specifying a base branch other than main. The script creates the worktree under .worktrees/, copies your .env files, and prints the path to cd into.

How do I switch between multiple Git worktrees?▼

Use the switch command with the worktree name, or run it without arguments to see an interactive list of available worktrees. The list command shows each worktree's branch and marks the currently active one.

Do Git worktrees share the same repository history?▼

Yes, worktrees share git objects and history with the main repository, making them lightweight compared to cloning. Each worktree has its own branch and working directory, so changes in one do not affect others.

Why are my .env files missing in a new Git worktree?▼

Worktrees created with raw git worktree add do not include untracked files like .env. Use the copy-env command of the manager script to copy .env, .env.local, and .env.test files from the main repository into the worktree.

Why can't I remove a Git worktree during cleanup?▼

Git refuses to remove the worktree you are currently inside. Navigate back to the main repository root first, then run the cleanup command, which interactively removes only inactive worktrees after confirmation.