using-git-worktrees

Create isolated Git worktrees for feature branches with setup commands.

Updated Jan 28, 2026
One-click install
npx skills add https://github.com/kckylechen1/ai-agent-toolkit --skill using-git-worktrees-kckylechen1
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: using-git-worktrees
Source: https://github.com/kckylechen1/ai-agent-toolkit/tree/main/skills/using-git-worktrees
Command: npx skills add https://github.com/kckylechen1/ai-agent-toolkit --skill using-git-worktrees-kckylechen1

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill helps engineers start feature work in an isolated workspace by creating and managing Git worktrees, preventing changes to the current checkout and enabling parallel development across branches.

Core Features & Use Cases

  • Create isolated worktrees for new feature branches without altering the main workspace.
  • Validate and respect ignore rules to prevent accidental commits of worktrees.
  • Auto-select storage location (project-local or global) based on preferences and CLAUDE.md guidance.
  • Seamlessly integrate with common tech stacks (Node, Rust, Python, Go) by auto-running project setup in the new worktree.
  • Use Case: When starting work on a feature, set up a dedicated worktree, implement changes, and merge back without disrupting the main branch.

Quick Start

Announce at start: I'm using the using-git-worktrees skill to set up an isolated workspace.

  1. Determine the desired branch name (BRANCH_NAME) and project name.
  2. Create the worktree: git worktree add "<path>" -b "<BRANCH_NAME>".
  3. Change directory into the new worktree: cd "<path>".
  4. Run project setup commands based on project files (e.g., npm install, cargo build, pip install) if applicable.

Frequently Asked Questions about using-git-worktrees

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

FAQPage Schema
How do I create an isolated Git worktree for feature development?

To create an isolated Git worktree, specify a branch name and path, then run `git worktree add` to generate a dedicated workspace without altering your main checkout, allowing parallel feature development.

What is the best way to manage multiple feature branches without disrupting my main workspace?

Using Git worktrees is the best way to manage multiple branches, as it creates isolated local directories for each feature, preventing accidental changes to your primary checkout and enabling seamless parallel development.

How do I prevent accidentally committing my Git worktree directories?

To prevent accidental commits, validate your ignore rules before setup. This Skill ensures your `.gitignore` configurations are respected, keeping worktree directories safe from being tracked in your main repository.

Can I auto-run project setup commands like npm install or cargo build in a new worktree?

Yes, after creating a worktree, this setup process can automatically run project setup commands like `npm install`, `cargo build`, or `pip install` by detecting project files within the new isolated directory.

Does Git worktree setup work with both global and project-local storage locations?

Yes, Git worktree setup supports both local and global storage locations. It auto-selects the destination based on your directory preferences and project guidance to safely isolate your feature work.

Why should I use Git worktrees for feature development instead of cloning the repository again?

Git worktrees share a single repository history, saving disk space and sync time compared to cloning. They provide immediate isolated workspaces for parallel branch development without duplicating the entire `.git` directory.