using-git-worktrees

Creates isolated git worktrees with directory selection, ignore verification, and baseline test checks.

Updated Apr 29, 2026
One-click install
npx skills add https://github.com/fred-meng/harness --skill using-git-worktrees-fred-meng
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: using-git-worktrees
Source: https://github.com/fred-meng/harness/tree/main/.github/skills/using-git-worktrees
Command: npx skills add https://github.com/fred-meng/harness --skill using-git-worktrees-fred-meng

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Working on multiple branches simultaneously often requires stashing changes or cloning the repository again, which disrupts your current workspace. This Skill sets up isolated git worktrees so feature work proceeds without touching your main checkout, while preventing common mistakes like committing worktree contents or starting from a broken baseline. ## Core Features & Use Cases - Smart Directory Selection: Follows a priority order (existing .worktrees/ or worktrees/ directory, then CLAUDE.md preference, then asks the user) to pick a consistent worktree location. - Safety Verification: Checks with git check-ignore that project-local worktree directories are gitignored before creation, and fixes the .gitignore if not. - Automated Setup and Baseline Validation: Auto-detects the project type (Node.js, Rust, Python, Go), installs dependencies, and runs the test suite to confirm a clean baseline before implementation begins. - Use Case: Before executing an implementation plan for a new auth feature, use this Skill to create .worktrees/auth on a new branch, run npm install, and verify all 47 existing tests pass so new bugs are distinguishable from pre-existing failures. ## Quick Start Set up an isolated git worktree for my new feature branch and verify the project tests pass before I start implementing.

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 a git worktree for a new feature branch?

Run git worktree add with a target path and the -b flag to create a new branch, for example git worktree add .worktrees/auth -b feature/auth. This Skill automates that plus directory selection, dependency installation, and test verification.

Where should git worktrees be stored in a project?

This Skill checks for an existing .worktrees or worktrees directory first, then any CLAUDE.md preference, then asks you. Project-local directories must be gitignored; a global location under ~/.config/superpowers/worktrees avoids that requirement.

Why must worktree directories be added to .gitignore?

Project-local worktree contents would otherwise appear in git status and risk being committed to the repository. The Skill runs git check-ignore before creation and adds the directory to .gitignore with a commit if it is not already ignored.

What happens if tests fail in a new worktree?

The Skill runs the project's test suite after setup to establish a clean baseline. If tests fail, it reports the failures and asks whether to proceed or investigate, so pre-existing issues are not confused with new bugs.

Does git worktree setup work with Python or Rust projects?

Yes, the Skill auto-detects project type from marker files: package.json triggers npm install, Cargo.toml triggers cargo build, requirements.txt or pyproject.toml trigger pip or poetry install, and go.mod triggers go mod download.