using-git-worktrees

Creates isolated Git feature branches or worktrees for spec-driven development workflows.

Updated Jun 11, 2026
One-click install
npx skills add https://github.com/Marcel-Carrillo/ProyectosIA --skill using-git-worktrees-marcel-carrillo
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: using-git-worktrees
Source: https://github.com/Marcel-Carrillo/ProyectosIA/tree/main/ai-specs/skills/using-git-worktrees
Command: npx skills add https://github.com/Marcel-Carrillo/ProyectosIA --skill using-git-worktrees-marcel-carrillo

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Starting feature work directly on main or in a dirty workspace risks mixing unrelated changes and losing work. This Skill enforces a deterministic isolation strategy—feature branches by default, Git worktrees when needed—before any implementation begins in an OpenSpec spec-driven workflow. ## Core Features & Use Cases - Workspace Detection: Inspects current branch, worktree state, remotes, and uncommitted changes before deciding whether isolation is needed. - Branch and Worktree Creation: Creates feature branches from the develop integration branch, or sets up Git worktrees under .worktrees/ with proper .gitignore handling and optional Claude settings copying. - Safe Cleanup: Verifies there are no uncommitted or unpushed changes before removing worktrees or deleting branches, requiring explicit user confirmation. - Use Case: Before running an OpenSpec /opsx:apply change, use this Skill to create a feature/<change-name> branch from develop, verify the remote points to the expected repository, and report a workspace isolation summary. ## Quick Start Ask the agent to set up an isolated feature branch or Git worktree for the upcoming OpenSpec change 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 a Git worktree for a new feature branch?▼

Run git worktree add with a target path and the -b flag to create a new branch, for example git worktree add .worktrees/feature/my-change -b feature/my-change. Ensure .worktrees/ is listed in .gitignore first so the directory is not tracked.

When should I use a Git worktree instead of a feature branch?▼

Use a worktree when you have unrelated uncommitted changes, need multiple parallel working directories, or want to isolate a risky experiment. A normal feature branch is sufficient when the workspace is clean and the task is small or medium.

How do I safely remove a Git worktree without losing work?▼

Check git status --porcelain and git log @{u}.. inside the worktree to confirm there are no uncommitted or unpushed changes. Then run git worktree remove <path> and git worktree prune from outside the worktree, using --force only with explicit confirmation.

Should feature branches be created from main or develop?▼

Feature branches should be created from develop, which acts as the integration branch. If currently on main or master, fetch the remote, check out develop, pull the latest changes, and then branch from there.

Why does git worktree remove fail with an error?▼

Removal fails when the worktree contains uncommitted changes or untracked files. Commit, stash, or discard the changes first, or use git worktree remove --force only after explicitly confirming the work can be discarded.