using-git-worktrees

Create and manage isolated Git worktrees for feature branches.

16|9|Updated Nov 6, 2013
One-click install
npx skills add https://github.com/erikstmartin/dotfiles --skill using-git-worktrees-erikstmartin
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: using-git-worktrees
Source: https://github.com/erikstmartin/dotfiles/tree/main/skills/global/.agents/skills/using-git-worktrees
Command: npx skills add https://github.com/erikstmartin/dotfiles --skill using-git-worktrees-erikstmartin

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Isolated Git worktrees enable safe, parallel development by giving you separate working directories that share the same repository.

Core Features & Use Cases

  • Create a dedicated worktree for a feature branch without switching the main HEAD.
  • Verify and enforce ignore rules to avoid accidentally committing worktrees.
  • Automatically detect project name and choose an appropriate local or global worktree location.
  • Run project-specific setup in the new worktree (node, rust, python, etc.)

Quick Start

Create a new worktree for a feature branch and set up the project in the isolated directory.

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 isolated Git workspaces for parallel branch development?

You can create isolated Git workspaces by generating separate worktrees that share a single repository, allowing you to safely develop features in parallel without switching branches in the main working directory.

Can I automatically run project setup in a new Git worktree after creation?

Yes, the worktree creation process automatically executes post-creation project setup steps. This includes running project-specific toolchain setups for environments like Node, Rust, and Python directly within the new isolated directory.

How do I prevent accidentally committing a Git worktree to my repository?

To prevent accidentally committing worktrees, the creation process performs safety verification via gitignore checks. This enforces ignore rules to ensure your isolated workspaces are not tracked by the main repository.

Where should I place Git worktrees for safe task isolation?

Git worktrees can be placed in both local and global locations. The process implements directory selection priorities to automatically detect the project name and choose an appropriate local or global worktree location for your task.

What is the best way to manage multiple branches without switching the main HEAD?

Using Git worktrees is the best way to manage multiple branches without switching the main HEAD. This approach provides separate working directories for each branch, enabling safe experiments and multi-branch development without disrupting your main repository.

Does Git worktree creation work with different project toolchains?

Yes, Git worktree creation supports different project toolchains. It automatically detects the project requirements and runs the appropriate setup steps to configure toolchains like Node, Rust, or Python in the newly created worktree.