using-git-worktrees

Create isolated Git worktrees with directory selection and safety checks.

1|Updated Jan 5, 2023
One-click install
npx skills add https://github.com/riez/dots --skill using-git-worktrees-riez
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: using-git-worktrees
Source: https://github.com/riez/dots/tree/main/.config/agentic/skills/using-git-worktrees
Command: npx skills add https://github.com/riez/dots --skill using-git-worktrees-riez

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Git worktrees let you work on feature developments in isolated directories that share the same repository, preventing interference with your current workspace and reducing risk of accidental changes to the main branch.

Core Features & Use Cases

  • Smart directory selection: prioritizes project-local directories (.worktrees, then worktrees) with a clear fallback strategy.
  • Safety verification: ensures the selected directory is ignored by gitignore before creating the worktree, and guides fixes if not.
  • Auto-setup and validation: creates the worktree on a new branch, runs project setup commands when applicable, and verifies a clean baseline with tests if available.

Quick Start

Ask me to set up an isolated Git worktree for your feature 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 worktree for feature development?

To create an isolated Git worktree, the automation detects existing directories, consults CLAUDE.md for preferences, verifies gitignore rules, creates the worktree on a new branch, runs setup, and validates a clean baseline.

Why should I use Git worktrees instead of switching branches in my current workspace?

Git worktrees provide isolated directories sharing the same repository, preventing interference with your current workspace and reducing the risk of accidental changes to the main branch during feature development.

How do I ensure my Git worktree directory is safely ignored by gitignore?

The workflow includes safety verification that ensures the selected worktree directory is ignored by gitignore rules before creation, and it guides you through fixes if the directory is not properly ignored.

What is the best way to manage multiple worktree directories in a project?

Smart directory selection prioritizes project-local directories like .worktrees or worktrees with a clear fallback strategy, ensuring multiple isolated Git worktrees are organized safely without cluttering the workspace.

Does setting up a Git worktree run project setup commands automatically?

Yes, after creating the Git worktree on a new branch, the automation runs applicable project setup commands and verifies a clean baseline by executing tests if they are available in the repository.

Can I use Git worktrees when starting new feature work that requires workspace isolation?

Git worktrees are specifically applicable when starting new feature work that requires isolation from your current workspace, keeping directories clean while sharing the same repository history.