using-git-worktrees

Create isolated Git worktrees with directory validation and environment setup.

Updated May 4, 2026
One-click install
npx skills add https://github.com/fred29910/migra-go --skill using-git-worktrees-fred29910
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: using-git-worktrees
Source: https://github.com/fred29910/migra-go/tree/main/.agents/skills/using-git-worktrees
Command: npx skills add https://github.com/fred29910/migra-go --skill using-git-worktrees-fred29910

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Managing multiple feature branches often requires manual setup and risky changes to the working directory. This skill provides a safe, automated approach to creating isolated Git worktrees with predictable directories and built-in safety checks.

Core Features & Use Cases

  • Directory-first selection: preferentially use hidden or global worktree storage locations to minimize project clutter.
  • Safety verifications: verify that worktree paths are ignored by git to prevent accidental commits of worktrees.
  • Use cases: when starting a new feature or experiment, create a dedicated worktree to avoid polluting the main workspace.
  • Fallback prompts: if no preferred directory is found, prompt the user to choose between local or global storage options.

Quick Start

Create an isolated Git worktree following the directory preference, validate it is ignored by git, and initialize the project environment.

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 work?

Creating a git worktree involves applying directory prioritization to select a safe storage location, running gitignore checks, and validating the path before automated creation. This prevents accidental commits and initializes the project environment safely.

Why do I need isolated git worktrees in a multi-branch environment?

Isolated git worktrees prevent workspace pollution by providing dedicated, validated directories for each feature branch. This safe setup separates experiments from the main project, avoiding manual directory changes and accidental cross-branch commits.

What's the best way to prevent accidental commits of git worktrees?

Preventing accidental worktree commits requires safety verifications that check if the worktree path is properly ignored by git. By validating gitignore rules before creation, you ensure worktrees stay isolated from the main repository's tracked files.

Can I use a global storage location for git worktrees to reduce project clutter?

Using global storage locations reduces project clutter by moving worktrees outside the main repository. The directory-first selection prioritizes hidden or global paths, and uses fallback prompts to let you choose between local or global storage if needed.

What happens if no preferred directory is found for git worktree creation?

When no preferred directory is found, fallback prompts activate to ask you to choose between local or global storage options. This interactive step ensures the worktree creation process continues safely with explicit user input.