using-git-worktrees

Create isolated Git worktrees for development changes and cleanup.

2|Updated Mar 4, 2026
One-click install
npx skills add https://github.com/thesyntaxninja/syntaxninja-dojo --skill using-git-worktrees-thesyntaxninja
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: using-git-worktrees
Source: https://github.com/thesyntaxninja/syntaxninja-dojo/tree/main/skills/using-git-worktrees
Command: npx skills add https://github.com/thesyntaxninja/syntaxninja-dojo --skill using-git-worktrees-thesyntaxninja

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Isolates risky or parallel development work from the current repository workspace so that the main branch remains clean and recoverable if a plan or refactor leaves the code in a broken state.

Core Features & Use Cases

  • Isolated development: Create a separate working directory on a new branch to perform ralph loops, risky refactors, or parallel feature work without contaminating the current workspace.
  • Safe execution and cleanup: Guidance for committing inside the worktree, chaining to merge/PR workflows, and removing worktrees and branches after merge.
  • Scope-based activation: Use when a plan might leave the branch broken, when the user requests isolation, or when running multi-step automated workflows that need rollback points.

Quick Start

Create a worktree named dojo/<task-slug> under .claude/plugin/worktrees/<task-slug> and perform the feature work there so changes are isolated from the main 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 isolate risky refactors from my main git workspace?

You can isolate risky refactors by creating a git worktree on a new branch, which keeps your main workspace clean and recoverable if the plan leaves the code in a broken state. Work happens in a separate directory under .claude/plugin/worktrees/.

When should I use git worktrees for parallel feature development?

Use git worktrees for parallel feature development when running multi-step automated workflows, ralph loops, or risky refactors that might leave the branch broken and require a rollback point. They prevent workspace contamination across concurrent tasks.

How do I clean up a git worktree after merging a feature branch?

Clean up a git worktree after merging by running git worktree remove on the isolated directory, then deleting the corresponding branch. This safely removes both the working directory and the branch created for the isolated task.

What's the best way to manage branches during isolated feature work?

Managing branches during isolated feature work is best handled by creating a dedicated branch like dojo/<task-slug> with a corresponding worktree, committing changes inside that isolated directory, then chaining to merge or PR workflows for integration.

Can I run automated workflows in a git worktree without affecting my current branch?

Yes, you can run automated workflows in a git worktree without affecting your current branch. The worktree creates an isolated working directory on a separate branch, so any broken state from the workflow stays contained and recoverable.

Why use a git worktree instead of stashing changes before a refactor?

Git worktrees provide full workspace isolation for refactors, whereas stashing only temporarily shelves changes. Worktrees allow you to keep your main workspace active while working on a separate branch, making them safer for multi-step plans that might break code.