using-git-worktrees

Create isolated Git worktrees for feature development with safety checks.

Updated Apr 3, 2026
One-click install
npx skills add https://github.com/handsomelong922/my-codex-skills --skill using-git-worktrees-handsomelong922
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: using-git-worktrees
Source: https://github.com/handsomelong922/my-codex-skills/tree/main/skills/using-git-worktrees
Command: npx skills add https://github.com/handsomelong922/my-codex-skills --skill using-git-worktrees-handsomelong922

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Manage feature work in isolation without polluting the main workspace by creating dedicated Git worktrees that share the repository and maintain a clean baseline.

Core Features & Use Cases

  • Flexible directory selection: prefers project-local .worktrees, with a global option if needed.
  • Safety verification: ensures the chosen directory is ignored by git to prevent accidental commits.
  • Automated workflow: detects project name, creates a new worktree, then runs project setup (npm, cargo, pip, etc.) as appropriate.
  • Guidance for preference: can consult a CLAUDE.md hint to select a directory when multiple options exist.
  • Clear reporting: provides the final worktree location and readiness status.

Quick Start

Create a new isolated Git worktree for the current project and verify the directory ignores 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 an isolated Git workspace for feature development without polluting my main directory?

You can create an isolated Git workspace using Git worktrees, which share the repository history while keeping your main directory clean. The workflow verifies ignore rules, creates the worktree, and automatically runs project setup steps.

How does Git worktree branch management handle automated project setup after isolation?

After creating an isolated Git worktree, the workflow automatically detects the project name and runs context-appropriate setup steps such as npm, cargo, or pip installations, ensuring the new workspace is immediately ready for development.

What is the safest way to configure directory selection for Git worktrees to prevent accidental commits?

The safest way is to place worktrees in a project-local .worktrees directory that is explicitly ignored by Git. The workflow performs safety verification to ensure the chosen directory is ignored, preventing accidental commits of worktree configuration files.

Can I use a global directory for Git worktrees if a project-local option is not available?

Yes, you can use a global directory for Git worktrees if needed. The directory selection logic prefers a project-local .worktrees folder but supports a global alternative, and can consult a CLAUDE.md hint to decide when multiple directory options exist.

Why do I need to verify ignore rules before starting multi-branch isolation with Git worktrees?

You need to verify ignore rules to ensure the worktree directory is ignored by Git. This safety check prevents the worktree files themselves from being accidentally tracked and committed into the main repository, keeping your baseline clean.