using-git-worktrees

Create isolated git worktrees with new branches and run dependency setup and tests.

154|1|Updated Feb 20, 2026
One-click install
npx skills add https://github.com/haojing8312/WorkClaw --skill using-git-worktrees-haojing8312
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: using-git-worktrees
Source: https://github.com/haojing8312/WorkClaw/tree/main/.claude/skills/using-git-worktrees
Command: npx skills add https://github.com/haojing8312/WorkClaw --skill using-git-worktrees-haojing8312

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill eliminates workspace contamination and branch-switching friction by creating isolated git worktrees with safety checks and automated setup so feature work can proceed without polluting the main repository.

Core Features & Use Cases

  • Smart directory selection: prefers .worktrees or worktrees, respects CLAUDE.md preferences, and prompts when ambiguous.
  • Safety verification: checks that project-local worktree directories are git-ignored and adds a .gitignore entry and commit when needed to prevent accidental tracking.
  • Automated setup and baseline verification: creates a new branch worktree, runs dependency installation for common ecosystems, and executes the test suite to confirm a clean starting point.
  • Use Case: Start a feature branch in an isolated workspace to iterate on features concurrently, run experiments, or prepare CI-like environments without switching the main working tree.

Quick Start

Create an isolated .worktrees worktree for branch feature/auth, ensure the directory is git-ignored, run the project setup, and run tests to confirm a clean baseline.

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

Git worktrees allow simultaneous isolated branch checkouts in separate directories, preventing workspace contamination. This Skill automates the process by handling directory selection, branch creation, dependency installation, and test suite execution to verify a clean baseline.

How do I ensure my local git worktree directories are git-ignored?

To ensure local worktree directories are git-ignored, this Skill verifies your .gitignore file and automatically adds the required entry and commit if missing. This prevents accidental tracking of the worktree folder in your main repository.

Can I run dependency setup and test suites automatically when creating a new git worktree?

Yes, dependency setup and test suites run automatically. After creating the isolated worktree and new branch, the Skill executes dependency installation for common ecosystems and runs the project test suite to confirm a clean starting baseline.

What is the best way to manage multiple git branches without contaminating the main workspace?

Using isolated git worktrees is the best way to manage multiple branches without contaminating the main workspace. This approach creates separate directory checkouts for feature prototyping or CI-adjacent workflows, eliminating branch-switching friction while keeping your main repository clean.

Does setting up git worktrees work with existing CLAUDE.md preferences for directory selection?

Yes, setting up git worktrees respects existing CLAUDE.md preferences for directory selection. The Skill prefers .worktrees or worktrees directories, reads your configuration, and prompts when directory choices are ambiguous to ensure proper isolation setup.