git-worktree

Create, list, remove, and migrate Git worktrees under a unified directory convention.

1|Updated Sep 11, 2026
One-click install
npx skills add https://github.com/lldwb/lldwb-claude-skills --skill git-worktree-lldwb
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: git-worktree
Source: https://github.com/lldwb/lldwb-claude-skills/tree/main/skills/git-worktree
Command: npx skills add https://github.com/lldwb/lldwb-claude-skills --skill git-worktree-lldwb

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Managing multiple Git branches in parallel usually means constant stashing, switching, or cloning the repo again. This Skill manages Git worktrees in a unified sibling directory so you can develop several branches side by side without interfering with your main working tree, while handling environment file copying and uncommitted-change migration safely. ## Core Features & Use Cases - Unified worktree lifecycle: Create, list, remove, and prune worktrees under a single root directory (default <repo sibling>/.zcf/<project>/), with smart defaults for branch names and base branches (main/master). - Environment file bootstrap: Automatically copies gitignored .env files into new worktrees (skipping templates like .env.example), and can open the result in your IDE. - Safe migration and deletion: Moves uncommitted changes or stash content between worktrees with source/target cleanliness checks, and refuses to delete dirty directories or branches. - Use Case: You need to fix a hotfix branch while your feature branch has uncommitted work. Ask to create a worktree for the hotfix, migrate the relevant changes, and later remove it cleanly once merged. ## Quick Start Ask the AI to create a worktree named feature-ui from the main branch, copy the environment files, and open it in your IDE.

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 branch development?

Run the add command with a worktree name, and it creates a new branch from main or master in a unified sibling directory. You can override the branch name with -b and open the result in your IDE with -o.

How to move uncommitted changes to another Git worktree?

Use the migrate command with --from to transfer uncommitted changes, or --stash to apply stashed content to a target worktree. The skill verifies the source has changes and the target is clean before migrating via stash push/pop or git diff and apply.

Does git worktree remove delete the branch too?

No, removing a worktree only deletes the working directory and its git reference; the branch is preserved. The skill checks the directory is clean before removal and refuses to use --force unless you explicitly confirm discarding changes.

Why does git worktree list show directories that no longer exist?

When a worktree directory is deleted manually with rm -rf, Git keeps a stale administrative record. Running git worktree prune cleans up these orphaned entries so the list reflects only existing directories.

When should I use worktrees instead of stashing or cloning?

Use worktrees when you need two branches checked out simultaneously, such as fixing a hotfix while a feature branch has uncommitted work. Worktrees share the main repository's .git directory, avoiding a full clone, though dependencies like node_modules must be installed separately.