git-worktrees
Use Git worktrees to isolate tasks and keep diffs small and parallelizable
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.
| name | git-worktrees |
|---|---|
| description | Use Git worktrees to isolate tasks and keep diffs small and parallelizable |
| version | 0.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
- Pre-check:
git status --porcelainmust be clean. - Suggest names:
wt-TASK-<id>orwt-<short-topic>. - Commands:
- Create:
git worktree add ../<name> <base-branch> - Switch: open the new dir; confirm branch
- Remove (after merge):
git worktree remove ../<name>
- Create:
- 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.