using-git-worktrees

Create isolated git worktrees with automated project setup and test validation.

Updated Oct 22, 2025
One-click install
npx skills add https://github.com/franroa/chezmoi --skill using-git-worktrees-franroa
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: using-git-worktrees
Source: https://github.com/franroa/chezmoi/tree/main/dot_opencode/superpowers/skills/using-git-worktrees
Command: npx skills add https://github.com/franroa/chezmoi --skill using-git-worktrees-franroa

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Managing multiple features or experiments often leads to messy workspaces, branch switching headaches, and accidental commits. This Skill provides a clean, isolated environment for each task, ensuring your main branch remains pristine.

Core Features & Use Cases

  • Isolated Workspaces: Create separate Git worktrees for new features or bug fixes without affecting your main branch.
  • Smart Directory Selection: Automatically or interactively choose the best location for your worktree, ensuring proper .gitignore setup.
  • Automated Setup: Detects project type (Node.js, Rust, Python, Go) and runs npm install, cargo build, pip install, etc., for a ready-to-use environment.
  • Use Case: Before starting a new feature, use this Skill to create a dedicated worktree. It handles all setup, so you can jump straight into coding without worrying about environment conflicts or accidental commits.

Quick Start

Announce skill usage

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

The skill will then guide you through directory selection and setup.

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 worktrees for feature development?

Git worktrees let you create separate working directories linked to your repository without switching branches. Use `git worktree add -b BRANCH_NAME` to spin up an isolated workspace for each feature, keeping your main branch clean and enabling parallel work on multiple tasks simultaneously.

Can I use git worktrees to avoid branch switching conflicts?

Yes. Worktrees eliminate branch-switching friction by maintaining separate directories for each task. You work in isolation without affecting your current workspace, preventing accidental commits and merge conflicts while juggling multiple features or bug fixes.

What's the best way to set up dependencies after creating a worktree?

Worktree setup auto-detects your project type—Node.js, Rust, Python, or Go—and runs the appropriate installer (npm install, cargo build, pip install, go mod download). The environment is ready to use immediately after creation without manual configuration.

Do I need to manually configure .gitignore for worktrees?

No. The skill enforces .gitignore verification for project-local worktrees automatically, ensuring proper isolation. It validates a clean baseline by running tests before reporting readiness, so your worktree is safe and isolated from the start.

Where do git worktrees get stored in my project?

Worktrees support multiple locations: project-local directories (.worktrees or worktrees), global storage, or a CLAUDE.md-specified path. The skill follows a priority order—existing directories first, then preferences, then prompts—to place worktrees optimally for your workflow.

Can I use worktrees if my repository has dependencies in multiple formats?

Yes. The skill auto-detects and handles mixed setups by recognizing package.json, Cargo.toml, requirements.txt, pyproject.toml, or go.mod files. It runs the correct setup commands for your project structure, supporting polyglot and monorepo workflows.