using-git-worktrees

Sets up an isolated Git workspace for feature implementation using worktree tools.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill prevents accidental changes to your current Git branch by creating or reusing an isolated workspace for feature work.

Core Features & Use Cases

  • Detects existing isolation first: Safely determines whether you are already inside a linked worktree and avoids creating nested or duplicate isolation.
  • Uses native tooling when possible: Prefers platform- or harness-provided worktree creation mechanisms to avoid phantom state.
  • Falls back to manual git worktrees with guardrails: Creates a worktree only when needed, chooses a directory by priority, verifies project-local ignore rules, sets up dependencies, and runs baseline tests.
  • Use case: You’re about to implement a multi-step feature and want to protect your main branch from churn and make sure the new workspace begins with a clean, testable baseline.

Quick Start

Use the skill to set up an isolated workspace for starting a new feature without risking your current branch.

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

To create an isolated Git workspace, the skill sets up a linked worktree using native tools or a manual fallback, ensuring your main branch is protected from churn. It selects a safe directory, installs dependencies, and runs baseline tests.

What is the best way to prevent accidental changes to my current Git branch?

Preventing accidental changes involves working in a separate Git worktree rather than directly in your main checkout. This skill detects existing isolation and creates a new worktree only when needed, verifying ignore rules and a clean test baseline.

Why does my dependency installation fail after switching Git branches in the same directory?

Dependency installation issues after switching branches often stem from conflicting project states. This skill resolves this by setting up an isolated worktree and automatically running dependency installation to ensure the new workspace starts with a clean state.

Does this Git worktree setup detect if I am already in an isolated workspace?

Yes, detecting existing isolation is a core feature. It safely determines whether you are already inside a linked worktree and avoids creating nested or duplicate isolation, preventing phantom state and directory conflicts.

Can I use native worktree tools instead of manual Git commands for branch isolation?

Yes, the skill prefers platform- or harness-provided worktree creation mechanisms to avoid phantom state. It only falls back to manual git worktree commands with guardrails when native tooling is unavailable.

When do I need to verify project-local ignore rules for my Git worktree?

Verifying project-local ignore rules is necessary when creating a manual Git worktree to ensure the new directory is not accidentally committed. This skill automatically checks ignore rules during safe directory selection.