git-worktrees

Use Git worktrees to isolate tasks and keep diffs small and parallelizable

⭐1stars🔀0forks📁View on GitHub🕐Updated Nov 10, 2025

When & Why to Use This Skill

The Git Worktrees skill optimizes software development workflows by enabling the creation of isolated, parallel environments for distinct tasks. By leveraging native Git worktree functionality, this skill allows developers to manage multiple branches simultaneously without the overhead of constant stashing or re-cloning, ensuring clean diffs, organized workspaces, and streamlined code reviews.

Use Cases

  • Parallel Task Execution: Seamlessly switch to a high-priority bug fix on a separate branch while keeping your current feature development state fully intact in a different directory.
  • Code Review and Comparison: Open multiple versions of a codebase side-by-side to compare implementations or verify fixes across different release branches without switching context.
  • Experimental Spikes: Create a dedicated, isolated workspace for architectural experiments or 'spikes' to prevent experimental code from accidentally polluting your primary development environment.
  • Conflict Resolution: Manage complex merges or rebases in a separate worktree to maintain a clean working directory for other urgent tasks.
namegit-worktrees
descriptionUse Git worktrees to isolate tasks and keep diffs small and parallelizable
version0.1.0
tags[git, workflow]

Git Worktrees

Purpose

Create parallel worktrees for distinct tasks to keep changes isolated and reviews clean.

When to Use

  • Parallel task execution; spikes; conflicting changes

Behavior

  1. Pre-check: git status --porcelain must be clean.
  2. Suggest names: wt-TASK-<id> or wt-<short-topic>.
  3. Commands:
    • Create: git worktree add ../<name> <base-branch>
    • Switch: open the new dir; confirm branch
    • Remove (after merge): git worktree remove ../<name>
  4. Cleanup checklist.

Guardrails

  • Never create/remove with dirty status.
  • Echo exact commands; do not execute automatically.

Integration

  • /lazy task-exec (optional), Coder agent setup phase.

Example Prompt

Create a dedicated worktree for TASK-1.2 on top of feature/auth.