using-git-worktrees

Create an isolated git worktree for a feature branch with safety checks.

1|1|Updated Dec 1, 2025
One-click install
npx skills add https://github.com/shmily1012/AutoWriter --skill using-git-worktrees-shmily1012
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: using-git-worktrees
Source: https://github.com/shmily1012/AutoWriter/tree/main/.claude/skills/using-git-worktrees
Command: npx skills add https://github.com/shmily1012/AutoWriter --skill using-git-worktrees-shmily1012

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Isolate development work by creating a dedicated git worktree that shares the same repository but keeps feature changes separate, preventing contamination of the main workspace.

Core Features & Use Cases

  • Directory selection priority: prefer an existing hidden .worktrees if present, else worktrees, then consult CLAUDE.md preferences, otherwise prompt the user to choose a location.
  • Safety verification: verify the chosen directory is ignored by git before creating the worktree to avoid committing worktree contents.
  • Automatic project setup: run appropriate setup steps for common environments (Node.js, Rust, Python, Go) after creating the worktree.
  • Use case: safely develop a new feature on a separate branch while maintaining a clean main workspace and ready-to-run tests.

Quick Start

Set up an isolated git worktree for my current project.

Frequently Asked Questions about using-git-worktrees

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I isolate git feature branch work to prevent workspace contamination?

Git worktrees prevent workspace contamination by creating a dedicated directory that shares the repository but keeps feature branch changes separate. This allows safe experimentation across project directories without affecting the main workspace.

What is the best way to manage multiple git branches without switching in one directory?

Using git worktrees is the best way to manage multiple branches without switching context in a single directory. You can develop a new feature on a separate branch while maintaining a clean main workspace and ready-to-run tests.

How do I set up a safe git worktree for local development?

To set up a safe git worktree for local development, the tool enforces directory selection priority, verifies the target directory is ignored by git to prevent accidental commits, and optionally runs project setup steps for Node.js, Rust, Python, or Go environments.

Does git worktree setup work with my existing Node.js or Rust project environment?

Yes, git worktree setup works with Node.js, Rust, Python, and Go project environments. After creating the isolated worktree, it automatically runs the appropriate setup steps required to prepare your specific development environment.

How do I ensure my git worktree directory is not accidentally committed to the repository?

To ensure your git worktree directory is not accidentally committed, the setup performs safety verification by checking gitignore rules. It prefers existing hidden directories like .worktrees and confirms the chosen location is properly ignored before creating the worktree.

Can I use CLAUDE.md preferences to configure git worktree directory locations?

Yes, you can use CLAUDE.md preferences to configure git worktree directory locations. The directory selection priority checks for an existing hidden .worktrees folder, then a worktrees folder, then consults CLAUDE.md, before prompting you to choose a location.