Using Git Worktrees

Create isolated Git worktrees with dependency setup and test verification.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/fz42net/superpowers-skills --skill using-git-worktrees-fz42net
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Using Git Worktrees
Source: https://github.com/fz42net/superpowers-skills/tree/main/skills/collaboration/using-git-worktrees
Command: npx skills add https://github.com/fz42net/superpowers-skills --skill using-git-worktrees-fz42net

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Developers often struggle with context switching between tasks, leading to uncommitted changes, merge conflicts, and a messy workspace. Git worktrees provide isolated environments, but setting them up consistently and safely can be tricky.

Core Features & Use Cases

  • Isolated Workspaces: Create separate working directories for different branches, allowing parallel development.
  • Smart Directory Selection: Guides on choosing the optimal location for worktrees (project-local vs. global).
  • Safety Verification: Mandates .gitignore checks to prevent accidental commits of worktree contents.
  • Automated Setup: Auto-detects and runs project-specific dependency installations (npm, cargo, pip, go mod).
  • Clean Baseline Verification: Runs tests after setup to ensure a stable starting point.
  • Use Case: When you're working on a new feature but need to quickly switch to a bug fix on another branch without stashing or committing your current work. This skill sets up a clean, isolated environment for the bug fix.

Quick Start

  1. Announce: "I'm using the Using Git Worktrees skill to set up an isolated workspace."
  2. The AI will guide you through directory selection and .gitignore verification.
  3. The AI will create the worktree: git worktree add .worktrees/feature-branch -b feature-branch.
  4. It will then run project setup (e.g., npm install) and verify tests.
  5. You'll receive a report when the worktree is ready.