git-worktrees

Create, list, remove, and prune Git worktrees for isolated parallel development environments.

3|1|Updated Feb 26, 2026
One-click install
npx skills add https://github.com/wopal-cn/wopal-space-ontology --skill git-worktrees-wopal-cn
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: git-worktrees
Source: https://github.com/wopal-cn/wopal-space-ontology/tree/main/skills/git-worktrees
Command: npx skills add https://github.com/wopal-cn/wopal-space-ontology --skill git-worktrees-wopal-cn

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve? Working on multiple features or urgent hotfixes in the same repository forces constant branch switching, stashing, and risk of mixing uncommitted changes. This Skill manages Git worktrees at the workspace level so each branch gets its own isolated directory without touching your current working state. ## Core Features & Use Cases - Workspace-Level Worktree Management: Create, list, remove, and prune worktrees under a unified .worktrees/ directory across all projects in the workspace. - Automatic Main Branch Detection: Identifies each project's main branch via git ls-remote --symref with fallbacks, and bases new worktrees on the latest committed state without checking dirty files. - Dependency Install Hints: After creation, detects the project type (Node.js, Python, Rust, Go) and prints the appropriate install command for manual execution. - Use Case: You need to ship a security hotfix while a feature branch is half-done. Create a worktree for hotfix/security-patch, fix and merge it, then remove the worktree — your in-progress feature work stays untouched. ## Quick Start Ask the agent to create a new worktree for a project and branch, for example: create a worktree for project ellamaka on branch feature/new-ui.

Frequently Asked Questions about git-worktrees

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 script with the create command, passing the project name and branch name. It creates a new branch from the local main branch's latest commit and places the worktree under .worktrees/<project>-<branch>.

How do I work on multiple branches at the same time in Git?

Use Git worktrees to check out each branch into its own directory. This Skill's script creates one worktree per branch under a shared .worktrees folder, so you can develop features in parallel without switching or stashing.

Can I create a worktree from an existing branch?

Yes, pass the --existing flag to the create command. The script verifies the branch exists first and errors out if it does not, instead of creating a new branch from main.

Does creating a worktree affect uncommitted changes?

No. The script bases the worktree on the local main branch's latest committed state and does not check the dirty working area or touch any uncommitted changes in your current checkout.

Why does worktree creation fail with local main branch not found?

The script requires a local ref for the detected main branch. Run git fetch origin main:main or check out the main branch once, then retry the create command.

How do I remove a Git worktree and its branch?

Run the remove command with the project and branch names. It removes the worktree directory, then deletes the local branch unless that branch is currently checked out.