git-worktree

Manage Git worktrees with create, list, switch, and cleanup operations.

Updated May 20, 2022
One-click install
npx skills add https://github.com/andrewhwaller/dotfiles --skill git-worktree-andrewhwaller
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: git-worktree
Source: https://github.com/andrewhwaller/dotfiles/tree/main/opencode/skills/git-worktree
Command: npx skills add https://github.com/andrewhwaller/dotfiles --skill git-worktree-andrewhwaller

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires git, and includes scripts (resource) components.

What problem does it solve?

Managing multiple Git worktrees manually is error-prone and hard to keep in sync with the main repository; this skill provides a single, consistent interface to create, list, switch, and clean up worktrees while ensuring environment files are copied and ignored appropriately.

Core Features & Use Cases

  • Create worktrees from the main branch with a dedicated name
  • List all worktrees and show their current status
  • Switch between worktrees and perform quick context changes
  • Clean up completed/inactive worktrees safely
  • Automatically manage .gitignore entries and copy environment files from the main repository

Quick Start

Create a new worktree called feature-login from main using the worktree manager.

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 safely?

Git worktree management automates creating, listing, switching, and cleaning up isolated worktrees for parallel development. A single manager script handles environment file copying and .gitignore updates to keep branches safely in sync.

How do I copy environment files when creating a new git worktree?

When creating a git worktree, environment files are automatically copied from the main repository. The manager also updates .gitignore entries to ensure these environment files remain properly ignored across all active worktrees.

What is the best way to clean up completed or inactive git worktrees?

The best way to clean up completed git worktrees is using a unified manager script that safely removes inactive worktrees via interactive prompts. This prevents manual errors and keeps the main repository synchronized.

Can I use interactive prompts to switch between git worktrees?

Yes, you can use interactive prompts to switch between git worktrees for quick context changes. The manager script provides a consistent interface to list statuses and safely switch branches without manual sync errors.

Do I need git installed to automate worktree management and branching?

Yes, you need git installed as a dependency to automate worktree management. The automation relies on git's native branching and worktree features to run isolated parallel development environments safely from a single script.