using-git-worktrees

Create isolated git worktrees with .gitignore safety checks and validation.

Updated Nov 14, 2025
One-click install
npx skills add https://github.com/Donaldshen27/xtrend-vanilla --skill using-git-worktrees-donaldshen27
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: using-git-worktrees
Source: https://github.com/Donaldshen27/xtrend-vanilla/tree/main/.claude/skills/using-git-worktrees
Command: npx skills add https://github.com/Donaldshen27/xtrend-vanilla --skill using-git-worktrees-donaldshen27

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Sets up isolated git worktrees for feature development to avoid disrupting the main workspace and to enable parallel work on multiple branches.

Core Features & Use Cases

  • Detect existing worktree directories and prefer the project-local .worktrees when present; create global worktrees only when requested.
  • Respect CLAUDE.md preferences for the target worktree location or prompt the user when no preference is defined.
  • Enforce safety checks on .gitignore before creating a worktree to prevent committing worktree contents.
  • Create, configure, and validate new worktrees, switch into them, and perform optional project setup commands as needed.

Quick Start

Initialize an isolated git worktree for your current feature branch and verify .gitignore safety checks before proceeding.

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 git worktrees for parallel feature development without disrupting my main workspace?

To create git worktrees, the workflow detects existing project-local .worktrees directories and sets up isolated branch checkouts safely. It enforces .gitignore checks to prevent committing worktree contents, configures the new worktree, and validates the setup before switching into it.

What's the best way to manage multiple git branches at the same time?

Using git worktrees is the best way to manage multiple branches simultaneously, as each worktree provides an isolated directory for a single branch. This avoids stashing or switching branches repeatedly in one workspace, keeping parallel feature development clean and separate.

Does creating a git worktree modify my existing .gitignore settings?

Creating a git worktree does not modify your .gitignore but enforces safety checks against it before creation. This validation step ensures worktree directories are properly ignored, preventing you from accidentally committing the worktree contents into the main repository.

Can I specify a custom directory location for my git worktrees?

You can specify a custom directory location for git worktrees, or the workflow will prefer a project-local .worktrees folder if it exists. It respects CLAUDE.md preferences for target locations and prompts you for a path when no preference is defined.

Why should I use git worktrees instead of cloning the repository again?

Git worktrees share the same repository history without duplicating the entire .git directory, making them more efficient than cloning. They provide safe isolation for parallel branching while honoring existing directories and allowing optional project setup commands to run automatically.

When should I not use git worktrees for branch isolation?

You should not use git worktrees if your .gitignore configuration does not properly exclude the target worktree directory, as the safety checks will flag this risk. The workflow validates this precaution to prevent accidentally committing isolated worktree contents.