using-git-worktrees

Create isolated Git worktrees with safety checks and baseline tests.

35|5|Updated Sep 20, 2025
One-click install
npx skills add https://github.com/zhanglongxiao111/indesign-cli --skill using-git-worktrees-zhanglongxiao111
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: using-git-worktrees
Source: https://github.com/zhanglongxiao111/indesign-cli/tree/main/.codex/skills/using-git-worktrees
Command: npx skills add https://github.com/zhanglongxiao111/indesign-cli --skill using-git-worktrees-zhanglongxiao111

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

When feature work or plan execution must not affect your main working directory, you need reliable isolation that prevents accidental commits and keeps setup reproducible.

Core Features & Use Cases

  • Directory Selection Priority: Chooses a worktree base directory using a clear order (existing hidden or visible worktrees directory first, then AGENTS.md, then legacy CLAUDE.md, otherwise asks the user).
  • Safety Verification for Project-Local Worktrees: Ensures project-local worktree directories are ignored via git check-ignore before creating them, and if not ignored it instructs you to update .gitignore, commit, and only then proceed.
  • Automated Bootstrap + Baseline Testing: Creates a new git worktree on an appropriate branch, runs project-appropriate dependency installation, and verifies a clean baseline by running the most relevant test command(s) detected by file presence.

Use case example: Before implementing an approved plan, you can create an isolated worktree tied to a dedicated branch, automatically install the needed dependencies for a Node/Rust/Python/Go project, and confirm tests pass before starting the real work.

Quick Start

Tell your AI agent to use the using-git-worktrees skill to create an isolated Git worktree, run the project setup, and verify the baseline tests before beginning 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 isolate feature implementation work from my main git working directory?

To isolate feature work from your main git working directory, use git worktrees to create a separate physical directory tied to a dedicated branch. This prevents cross-contamination and accidental commits during plan execution.

How does git worktree directory selection work with project configuration files?

Git worktree directory selection prioritizes existing worktrees directories, then checks AGENTS.md overrides, followed by legacy CLAUDE.md, and finally asks the user if no convention is found, ensuring repeatable setup aligned with repository-local rules.

Do I need to update .gitignore before creating a project-local git worktree?

Yes, you must update .gitignore before creating a project-local git worktree. The process verifies directories are ignored via git check-ignore; if not ignored, it instructs you to update .gitignore and commit before proceeding.

Can I automatically install dependencies and run baseline tests in a new git worktree?

Yes, you can automatically install dependencies and run baseline tests in a new git worktree. The automated bootstrap runs project-appropriate installation for Node, Rust, Python, or Go, and verifies a clean baseline by running relevant test commands detected by file presence.

What is the best way to ensure a clean test baseline before executing an approved plan?

The best way to ensure a clean test baseline before executing an approved plan is to create an isolated git worktree on a dedicated branch, automatically install dependencies, and run the most relevant test commands detected by file presence to verify tests pass.