using-git-worktrees

Create and manage isolated git worktrees for parallel development.

2|Updated Jul 11, 2024
One-click install
npx skills add https://github.com/nicograef/handbook --skill using-git-worktrees-nicograef
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: using-git-worktrees
Source: https://github.com/nicograef/handbook/tree/main/.claude/skills/using-git-worktrees
Command: npx skills add https://github.com/nicograef/handbook --skill using-git-worktrees-nicograef

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill solves the problem of context switching and branch collisions by allowing you to create isolated directory checkouts for specific tasks without needing to stash changes or juggle branches in your primary workspace.

Core Features & Use Cases

  • Isolated Environments: Create separate, independent directories for feature work or risky refactors that remain untouched by your main checkout.
  • Unattended Agent Runs: Safely run automated agents in their own dedicated branch and directory to prevent accidental interference with your current work.
  • Use Case: When you need to start a complex refactor but want to keep your current feature branch clean and ready for a quick hotfix, use this skill to spin up a dedicated worktree in seconds.

Quick Start

Use the using-git-worktrees skill to create an isolated directory for the new feature branch named experimental-refactor.

Frequently Asked Questions about using-git-worktrees

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

FAQPage Schema
How do I work on multiple git branches at the same time without stashing changes?

Git worktrees create isolated directory checkouts for specific branches, allowing parallel development without stashing or juggling branches in your primary workspace. Each branch gets its own project-local directory for safe, independent work.

What is the best way to run automated agent tasks safely in a git repository?

Git worktrees provide isolated branch checkouts for unattended agent runs, preventing accidental interference with your current work. Agents operate in dedicated directories that maintain a clean baseline for repository integrity.

Can I create isolated git worktrees for risky refactors without affecting my main checkout?

Yes, git worktrees create separate, independent directories that remain untouched by your main checkout. This lets you start complex refactors while keeping your primary workspace clean and ready for quick hotfixes.

Does using git worktrees work with repositories that have submodules?

Git worktrees verify submodules during creation to ensure repository integrity. The skill maintains a clean baseline for all new worktree instances, checking submodule status as part of the setup process.

How do I set up a dedicated worktree for a new feature branch?

Use the worktree skill to create an isolated directory for your named feature branch. It checks out the branch into a separate project-local directory, enabling context switching between your main workspace and the new feature work.

Why should I use git worktrees instead of cloning my repository multiple times?

Git worktrees share a single repository while providing isolated directory checkouts for each branch. This avoids the storage overhead and sync complexity of multiple clones, enabling parallel development with safe, independent environments.