using-git-worktrees

Create isolated Git worktree workspaces with dependency installation and baseline tests.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill prevents feature work from contaminating your current checkout by ensuring changes happen in an isolated workspace before implementation starts.

Core Features & Use Cases

  • Detect existing isolation first: Identifies whether you are already in a linked worktree or in a submodule to avoid creating nested/duplicate worktrees.
  • Create an isolated workspace safely: Prefers native platform worktree tools when available, and falls back to git worktree add only when necessary.
  • Preserve developer environment parity: Copies local Claude settings from the main checkout into the new worktree when using the git fallback.
  • Run setup and verify baseline: Automatically installs dependencies when relevant manifests are present and runs project-appropriate tests to confirm a clean start.
  • Clean up correctly: Removes the created worktree using the matching mechanism and blocks destructive cleanup when there are uncommitted or unpushed changes.

Quick Start

Ask your AI to "Set up an isolated workspace for my feature work using git worktrees, run the project setup, verify a clean baseline with tests, and tell me where the worktree is ready."

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

Git worktrees create isolated workspaces by adding a separate branch checkout in a repo-local directory, protecting your current branch from unintended changes during feature implementation. The Skill automates this setup safely.

What is the best way to protect my current git branch from unintended changes?

Protecting your current branch is best achieved by using git worktrees to create an isolated workspace before starting implementation. This ensures all feature changes happen in a separate directory without contaminating the main checkout.

Does git worktree setup copy Claude settings to the new branch workspace?

Yes, when using the git fallback mechanism, the setup copies local Claude settings from the main checkout into the new worktree to preserve developer environment parity across isolated workspaces.

Can I run dependency installation and baseline tests inside a git worktree?

Yes, the worktree setup automatically installs dependencies when relevant manifests are present and runs project-appropriate tests to verify a clean baseline before you begin feature work.

How does worktree cleanup handle uncommitted or unpushed changes?

Worktree cleanup removes the isolated workspace using the matching mechanism but blocks destructive deletion when there are uncommitted or unpushed changes, preventing accidental data loss.

What happens if I am already in a linked worktree or a git submodule?

The setup detects existing worktree or submodule state to avoid creating nested or duplicate worktrees, ensuring safe isolation without corrupting your repository structure.