using-git-worktrees

Create isolated Git worktrees with priority-based directory selection and safety verification.

1|Updated Jan 5, 2026
One-click install
npx skills add https://github.com/wedsamuel1230/electronic-mcp-server --skill using-git-worktrees-wedsamuel1230
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: using-git-worktrees
Source: https://github.com/wedsamuel1230/electronic-mcp-server/tree/main/.github/skills/using-git-worktrees
Command: npx skills add https://github.com/wedsamuel1230/electronic-mcp-server --skill using-git-worktrees-wedsamuel1230

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill enables developers to create isolated workspaces for feature work by using git worktrees, keeping the main workspace clean while exploring changes.

Core Features & Use Cases

  • Automated, safe setup of isolated worktrees using priority-based directory selection (.worktrees preferred, then worktrees, then global).
  • Safety verification to ensure the new worktree directory is ignored by git to prevent accidental commits.
  • Guided creation flow with project-name detection and CLAUDE.md-based preferences to determine location.
  • Real-world use case: start a new feature on a separate worktree without modifying your current checkout, enabling parallel development.

Quick Start

Use the using-git-worktrees skill to set up an isolated workspace.

  1. Check for existing directories in priority: .worktrees, then worktrees.
  2. If CLAUDE.md specifies a preference, honor it; otherwise ask for location between .worktrees and ~/.config/superpowers/worktrees/<project-name>.
  3. For project-local worktrees, verify the directory is ignored by git: git check-ignore -q .worktrees 2>/dev/null || git check-ignore -q worktrees 2>/dev/null If not ignored, add to .gitignore, commit, and proceed.
  4. Creation steps: project=$(basename "$(git rev-parse --show-toplevel)") path="$LOCATION/$BRANCH_NAME" or "~/.config/superpowers/worktrees/$project/$BRANCH_NAME" git worktree add "$path" -b "$BRANCH_NAME" cd "$path"
  5. Run project setup based on project files:
    • Node.js: npm install
    • Rust: cargo build
    • Python: pip install -r requirements.txt or poetry install
    • Go: go mod download
  6. Verify a clean baseline by running tests (npm test, cargo test, pytest, etc.) If tests fail, report and decide whether to proceed.
  7. Report: Worktree ready at <path>; Tests passing; Ready to implement <feature-name>

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

Git worktrees solve this by creating separate working directories linked to different branches. This lets you experiment with features in parallel while keeping your main checkout clean without needing multiple clones.

How do I ensure my git worktree directory is safely ignored from accidental commits?

Verify the worktree directory is ignored by running git check-ignore. If not ignored, add the directory path to .gitignore and commit the change before proceeding with worktree creation.

How do I automate project setup after adding a git worktree?

Automate setup by detecting project files and running corresponding build commands. The skill executes npm install, cargo build, pip install, or go mod download based on detected Node.js, Rust, Python, or Go environments.

Does git worktree creation support custom directory preferences?

Git worktree creation supports custom directory preferences by honoring CLAUDE.md configurations. If unspecified, it uses priority-based selection between local .worktrees and global ~/.config/superpowers/worktrees/ directories.

What should I do if tests fail after setting up a new git worktree?

If tests fail after setting up a git worktree, the skill reports the failure and prompts you to decide whether to proceed. It verifies a clean baseline by running project-specific tests like npm test, cargo test, or pytest before implementation.

Why use git worktrees instead of cloning repositories for parallel work?

Git worktrees provide isolated workspaces for parallel development without the disk overhead of cloning entire repositories. They share the same .git directory, allowing multiple branches to be checked out simultaneously in different directories.