using-git-worktrees

Create isolated git worktrees for feature branches with automated setup and test verification.

Updated Mar 16, 2026
One-click install
npx skills add https://github.com/chuangkevin/project-bridge --skill using-git-worktrees-chuangkevin
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: using-git-worktrees
Source: https://github.com/chuangkevin/project-bridge/tree/main/skill/superpowers/using-git-worktrees
Command: npx skills add https://github.com/chuangkevin/project-bridge --skill using-git-worktrees-chuangkevin

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Prevents workspace contamination and accidental commits when working on multiple branches by creating isolated, project-aware git worktrees with safety checks and automated setup.

Core Features & Use Cases

  • Priority-based directory selection: prefer .worktrees, then worktrees, then CLAUDE.md preference, otherwise ask the user.
  • Safety verification for project-local directories using git check-ignore and automatic .gitignore updates and commits when needed.
  • Automated creation workflow that detects project name, creates a new branch worktree, auto-runs dependency setup based on project files (package.json, Cargo.toml, pyproject.toml, go.mod), and verifies a clean test baseline before proceeding.
  • Typical use cases: starting feature branches that need isolation, preparing environments before executing implementation plans or subagent-driven development, and reproducing CI-local test baselines.

Quick Start

Create a project-local .worktrees/<branch> worktree, ensure the directory is git-ignored, run the appropriate dependency install for the project, and execute the test suite to confirm a clean baseline before implementing the feature.

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 isolated git workspaces for feature branches without affecting my current workspace?

To create isolated git workspaces, you can create git worktrees that set up separate directories for feature development. This prevents workspace contamination and accidental commits by keeping new branches in their own isolated working directories.

How do I keep project-local git worktree directories from being tracked in version control?

To keep git worktree directories untracked, verify the path using git check-ignore and automatically update the .gitignore file. The directory selection prioritizes .worktrees, then worktrees, or uses a global config path to prevent accidental commits.

How do I automatically run dependency setup commands when creating a new git worktree?

To automatically run dependency setup, the worktree creation process detects project tooling files like package.json, Cargo.toml, pyproject.toml, or go.mod. It then auto-runs the appropriate dependency install command for the detected project type.

Why do I need to verify a clean test baseline before starting feature work in a git worktree?

Verifying a clean test baseline before feature work ensures the isolated git worktree has a functional starting state. Running the test suite confirms the automated setup succeeded and prevents attributing pre-existing failures to your new feature changes.

Can I use git worktrees to prepare isolated environments for agent-driven development tasks?

Yes, you can use git worktrees to prepare isolated environments for agent-driven tasks and tests. This workflow creates a separate workspace where automated agents can safely execute implementation plans without risking your primary working directory.