using-git-worktrees

Create isolated git worktrees with automated dependency setup and baseline tests.

10|Updated Dec 15, 2014
One-click install
npx skills add https://github.com/baleen37/dotfiles --skill using-git-worktrees-baleen37
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: using-git-worktrees
Source: https://github.com/baleen37/dotfiles/tree/main/modules/shared/config/claude/skills/using-git-worktrees
Command: npx skills add https://github.com/baleen37/dotfiles --skill using-git-worktrees-baleen37

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Switching between branches for different tasks can be cumbersome and lead to context switching overhead. This skill automates the creation and setup of isolated Git worktrees, allowing you to work on multiple features simultaneously without interference.

Core Features & Use Cases

  • Isolated Workspaces: Create separate, clean working directories for each feature or bugfix, sharing the same Git repository.
  • Smart Directory Selection: Automatically determines the best location for new worktrees, respecting .gitignore rules.
  • Automated Setup: Runs project-specific dependency installations and baseline tests to ensure a clean starting point.
  • Use Case: Start working on a new feature/auth branch while keeping your main branch clean, without needing to stash or commit incomplete work.

Quick Start

Create a new worktree for a feature branch

(Assumes you are in the main repository directory)

git worktree add .worktrees/my-feature -b feature/my-feature cd .worktrees/my-feature

Project setup (e.g., npm install, cargo build) will run automatically

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 simultaneously without switching?

Git worktrees let you create isolated working directories for different branches from the same repository. Each worktree is a separate filesystem directory linked to your Git repo, so you can work on multiple features in parallel without stashing or switching branches.

What's the best way to set up a new feature branch with automatic dependency installation?

Create a worktree with `git worktree add .worktrees/feature-name -b feature/name`, then the Skill automatically runs project setup—npm install, cargo build, pip install, or poetry install—and baseline tests to verify readiness before you start coding.

Can I use Git worktrees to keep my main branch clean while developing?

Yes. Worktrees isolate feature work in separate directories so your main branch remains untouched. You develop in the worktree, test independently, and merge only when ready—eliminating context switching and incomplete work conflicts.

Where should I store worktrees—project-local or global directories?

The Skill handles directory selection automatically by checking project-local paths (.worktrees or worktrees) first, then global (~/.config/worktrees) if needed. It respects .gitignore safety rules to avoid storing worktrees in ignored locations.

Do I need to manually install dependencies after creating a worktree?

No. The Skill runs environment setup automatically after creating the worktree—detecting your project type and executing npm install, cargo build, pip/poetry install, or go mod download—then validates with baseline tests.