worktree-management
Git worktree helpers for parallel development. Use when working with git worktrees, managing parallel branches, or when user mentions worktrees, parallel development, or branch isolation.
When & Why to Use This Skill
The Worktree Management skill is a specialized Git utility designed to streamline parallel development by managing multiple Git worktrees. It enables developers to isolate branches into separate directories, allowing for simultaneous work on different features or bug fixes without the overhead of constant branch switching or 'git stash' commands. By providing automated scripts for creating, syncing, and cleaning up worktrees, it enhances workflow efficiency and prevents branch conflicts in complex software projects.
Use Cases
- Simultaneous Feature Development: Work on multiple independent features in parallel by isolating each branch into its own directory, avoiding the need to switch contexts within a single working tree.
- Urgent Hotfix Management: Quickly create a separate worktree to address a critical production bug without interrupting or stashing current progress on a long-running feature branch.
- Side-by-Side Code Comparison: Open and run two different versions of a codebase simultaneously to compare behavior, performance, or UI changes across different branches.
- Isolated Testing and CI: Run long-duration test suites or build processes in one worktree while continuing to write code in another, maximizing local development uptime.
| name | Worktree Management |
|---|---|
| description | Git worktree helpers for parallel development. Use when working with git worktrees, managing parallel branches, or when user mentions worktrees, parallel development, or branch isolation. |
| allowed-tools | Read, Bash, Write |
Worktree Management
This skill provides git worktree management helpers for parallel development and branch isolation.
What This Skill Provides
1. Worktree Operations
- Create worktrees for feature branches
- List active worktrees
- Remove completed worktrees
- Sync worktrees with main branch
2. Parallel Development Support
- Isolate work on separate branches
- Switch between features easily
- Prevent branch conflicts
3. Worktree Scripts
create-worktree.sh- Create new worktree for branchlist-worktrees.sh- Show all active worktreessync-worktree.sh- Sync worktree with maincleanup-worktree.sh- Remove completed worktrees
Instructions
Creating a Worktree
When user wants to work on a feature in parallel:
Create worktree for new feature: !{bash git worktree add ../project-feature-name -b feature-name}
User can now work in ../project-feature-name independently
Changes in main project don't affect the worktree
Listing Worktrees
Show all active worktrees:
!{bash git worktree list}
Syncing a Worktree
Sync worktree with latest main branch:
- Navigate to worktree
- Fetch latest changes
- Rebase or merge as appropriate
Removing a Worktree
When feature is complete:
!{bash git worktree remove ../project-feature-name}
Worktree Workflow Example
Scenario: Working on two features simultaneously
- Main project in
/project - Feature A in
/project-feature-a(worktree) - Feature B in
/project-feature-b(worktree)
Each can be developed independently without conflicts.
Best Practices
- Use worktrees for long-running features
- Keep worktrees in sibling directories
- Clean up completed worktrees regularly
- Sync worktrees before merging
- Use consistent naming conventions
Success Criteria
- ✅ Worktrees are created correctly
- ✅ Parallel development is isolated
- ✅ Syncing keeps worktrees up to date
- ✅ Cleanup removes unused worktrees
Plugin: 04-iterate Skill Type: Git Helpers + Scripts Auto-invocation: Yes (via description matching)