git-worktree

Manage Git worktrees for isolated parallel development with a manager script.

1|Updated Jan 11, 2025
One-click install
npx skills add https://github.com/krbylit/dotfiles --skill git-worktree-krbylit
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: git-worktree
Source: https://github.com/krbylit/dotfiles/tree/main/cm-util/pkg-backups/beads-compound/0.6.8/gemini/skills/git-worktree
Command: npx skills add https://github.com/krbylit/dotfiles --skill git-worktree-krbylit

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

Git worktrees are powerful but can be error-prone when used ad-hoc. This skill provides a single, safety-conscious manager to create, list, switch, and clean up worktrees for isolated parallel development, reducing accidental overwrites and misaligned environments.

Core Features & Use Cases

  • Create worktrees from the main branch with consistent naming and directory structure.
  • List all worktrees with status and current active one.
  • Switch between worktrees and clean up unused ones with confirmation prompts.
  • Automatic environment handling (copying .env files) and automatic .gitignore updates to keep things tidy.

Quick Start

Run the worktree-manager.sh script to create a new feature worktree from main and copy environment files automatically.

Frequently Asked Questions about git-worktree

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

FAQPage Schema
How do I manage Git worktrees for parallel development without overwriting changes?

Managing Git worktrees for isolated parallel development involves creating separate branches from main, listing them with status updates, and using confirmation prompts to safely clean up unused worktrees.

What is the safest way to switch between Git worktrees?

The safest way to switch between Git worktrees is using a dedicated manager script that tracks the active worktree and explicitly prevents operations on it, reducing accidental deletion risks.

How do I keep environment files synced when creating new Git worktrees?

When creating new Git worktrees, environment files like .env are automatically copied to the new directory, ensuring your isolated development environment stays aligned without manual setup.

Can I use Git worktrees for parallel code reviews and feature work?

Yes, Git worktrees are ideal for parallel code reviews and feature work because they provide isolated directories for each branch, keeping your main workspace clean and preventing context switching overhead.

Why does my Git worktree cleanup fail on the active branch?

Git worktree cleanup fails on the active branch because the safety manager explicitly prevents operations on the currently active worktree, requiring you to switch to another worktree before deletion.

Do I need to manually update .gitignore when using Git worktrees?

You do not need to manually update .gitignore when using Git worktrees because the manager script automatically updates .gitignore entries to keep your repository tidy and exclude worktree directories.