Using Git Worktrees

Create isolated git worktrees with directory selection and safety verification.

Updated Dec 4, 2025
One-click install
npx skills add https://github.com/dallascrilley/dowser --skill using-git-worktrees-dallascrilley
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: Using Git Worktrees
Source: https://github.com/dallascrilley/dowser/tree/main/skills/using-git-worktrees
Command: npx skills add https://github.com/dallascrilley/dowser --skill using-git-worktrees-dallascrilley

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Working on multiple branches simultaneously forces constant branch switching, stashing, and context loss. This Skill sets up isolated git worktrees so each feature gets its own workspace sharing the same repository, without polluting git status or breaking project conventions. ## Core Features & Use Cases - Smart Directory Selection: Follows a priority order of existing .worktrees/ or worktrees/ directories, then CLAUDE.md preferences, then asks the user. - Safety Verification: Checks .gitignore before creating project-local worktrees and fixes missing entries immediately to prevent committing worktree contents. - Automated Setup and Baseline: Auto-detects project type (Node.js, Rust, Python, Go), installs dependencies, and runs tests to verify a clean baseline before work begins. - Use Case: When a brainstorming session transitions to implementation, create an isolated worktree for the new feature branch, install dependencies, and confirm all tests pass before writing code. ## Quick Start Set up an isolated git worktree for my new feature branch and verify the project tests pass before I start implementing.

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 a git worktree for a new feature branch?▼

Run git worktree add with a target path and the -b flag to create a new branch, for example git worktree add .worktrees/auth -b feature/auth. Then change into that directory and install project dependencies before starting work.

Where should git worktrees be stored in a project?▼

Prefer an existing .worktrees or worktrees directory in the project, with .worktrees winning if both exist. If neither exists, check CLAUDE.md for a stated preference, otherwise ask the user or use a global location outside the repository.

Do git worktrees need to be added to .gitignore?▼

Yes, project-local worktree directories like .worktrees/ must be listed in .gitignore before creation, otherwise their contents pollute git status and risk being committed. Worktrees stored outside the project need no .gitignore entry.

Why run tests immediately after creating a worktree?▼

Running the test suite establishes a clean baseline so you can distinguish new bugs from pre-existing failures. If tests fail at baseline, report the failures and get explicit confirmation before proceeding with implementation.

Can git worktrees work with Node, Rust, Python, and Go projects?▼

Yes, setup is auto-detected from project files: package.json triggers npm install, Cargo.toml triggers cargo build, requirements.txt or pyproject.toml trigger Python installs, and go.mod triggers go mod download.