using-git-worktrees

Create isolated Git worktrees with branch separation and baseline test verification.

5|Updated Feb 8, 2026
One-click install
npx skills add https://github.com/tiancaiamao/ai --skill using-git-worktrees-tiancaiamao
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: using-git-worktrees
Source: https://github.com/tiancaiamao/ai/tree/main/skills/using-git-worktrees
Command: npx skills add https://github.com/tiancaiamao/ai --skill using-git-worktrees-tiancaiamao

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you start feature work in a clean, isolated Git worktree so you can change code without disturbing the current workspace or risking branch conflicts.

Core Features & Use Cases

  • Smart directory selection: Chooses an existing worktree location first, then checks project preferences, and only asks the user when no convention is available.
  • Safety verification: Confirms project-local worktree directories are ignored before creation to prevent accidental tracking in Git.
  • Baseline readiness: Creates the worktree, switches the agent into it, installs dependencies, and verifies the project passes its baseline tests.
  • Use case: Use this when you are about to implement a feature, run an isolated review, or launch parallel development tasks that must stay separate from the main workspace.

Quick Start

Tell the assistant to create an isolated git worktree for this repository, verify it is ignored, run the project setup, and confirm the baseline tests pass before starting implementation.

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 development?

An isolated git worktree separates parallel feature development from your main workspace by creating a new branch in a distinct directory. It prevents branch conflicts and keeps your current working directory completely undisturbed.

How do I prevent git worktree directories from being accidentally tracked?

Prevent accidental tracking by verifying that project-local worktree directories are added to git ignore rules before creation. This safety check ensures the new workspace files remain excluded from version control commits.

What is the best way to set up a git workspace for parallel branch work?

The best way to set up a parallel branch workspace is using git worktrees. This approach selects an existing worktree location first, then checks project preferences, and only prompts the user when no convention is available.

How do I validate baseline tests after switching to a new git worktree?

Validate baseline tests after switching into the new git worktree by installing project dependencies and running the test suite. The workspace setup is only confirmed ready when the project successfully passes these baseline checks.

When should I use a git worktree instead of stashing or branching in place?

Use a git worktree when you need safe, isolated branch work for feature implementation or review sessions that must stay separate from the main workspace. It avoids the risk of branch conflicts and the overhead of stashing uncommitted changes.

Does setting up a git worktree require manual dependency installation?

Setting up a git worktree automates dependency installation after creating the worktree and switching the agent into it. The process handles project setup automatically to ensure the new environment is fully ready for development.