worktree-ops
Skill22 starsChanged 9 months agoMITView on GitHub
Manage git worktrees for isolated parallel development sessions. Create, list, switch between, and remove worktrees with safety checks for uncommitted changes and unpushed commits. Use when the user wants to work on multiple branches simultaneously, run parallel sessions, or isolate experimental changes.
- Installs packages
In this repository44 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- accessibilitySkill
- api-designSkill
- cicdSkill
- clean-architectureSkill
- database-designSkill
- debuggingSkill
- design-patternsSkill
- dispatching-parallel-agentsSkill
- git-workflowSkill
- microservicesSkill
- performanceSkill
- refactoringSkill
- scrumSkill
- securitySkill
- solidSkill
- subagent-driven-developmentSkill
- testingSkill
- verification-before-completionSkill
- composer-dependenciesSkill
- finishing-branchSkill
- php-upgradeSkill
- ticket-deliverySkill
- architectSkill
- backend-devSkill
- frontend-devSkill
- product-managerSkill
- project-managerSkill
- qa-engineerSkill
- scrum-masterSkill
- agent-creatorSkill
- agentic-rules-writerSkill
- agent-teamsSkill
- brainstormingSkill
- dispatching-agent-teamsSkill
- image-annotateSkill
- plugin-creatorSkill
- pr-message-writerSkill
- report-writerSkill
- stakeholder-update-writerSkill
- ticket-writerSkill
- using-ecosystemSkill
- web-screenshotSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
18 rules. About 0 are common, 8 are distinctive, and 10 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈8
Distinctive · estimate
This author's own choices. Worth a look.
10
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 35
Create a new worktree for an isolated parallel development session.
- Distinctive: line 44
If the current working directory is already a worktree (not the main working tree), warn the user and stop.
- Very specific: line 45
If a name was provided as an argument, use it.
- Very specific: line 59
Run your stack's dependency installation command (e.g., composer install, npm install, pip install -r requirements.txt)
- Very specific: line 61
Use the list command to see all active worktrees
- Very specific: line 62
Use the remove command to clean up when done
- Very specific: line 89
If no worktrees exist beyond the main working tree, say: "No additional worktrees found.
- Very specific: line 102
If only the main working tree exists, say: "No worktrees available to switch to.
- Distinctive: line 103
If a name was provided as an argument, find the matching worktree path.
- Very specific: line 104
If the name does not match any existing worktree, say: "Worktree <name> not found." and show the available list.
- Distinctive: line 119
Remove one or all worktrees from the current repository.
- Distinctive: line 128
If no worktrees exist beyond the main working tree, say: "No worktrees to clean up." and stop.
- Very specific: line 130
If argument is all - remove all worktrees (except the main working tree).
- Distinctive: line 131
If a specific name was provided - remove only that worktree.
- Very specific: line 132
If no argument - show the list and present an interactive prompt (or the platform's equivalent): "Which worktree should I remove?
- Distinctive: line 138
If there are uncommitted changes or unpushed commits, warn the user:
- Distinctive: line 145
Wait for explicit confirmation before proceeding.
- Very specific: line 151
Use --force only after the user has confirmed in step 4.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Worktree Management
Git worktrees let you check out multiple branches of the same repository into separate directories simultaneously. Each worktree has its own working directory and index while sharing the same .git object store and history. This is useful for running parallel development sessions, reviewing a PR while mid-feature, or isolating experimental changes without stashing or committing half-finished work.
Core Principles
| Principle | Meaning |
| Isolation without duplication | Worktrees share git history but keep working directories separate - no need to clone the repo again |
| Safety first | Always check for uncommitted changes and unpushed commits before removing a worktree |
| Clean up after yourself | Stale worktree entries and orphaned branches accumulate - prune regularly |
| Convention over configuration | Use a consistent directory layout (.worktrees/<name>/) and branch naming (worktree-<name>) |
Quick Reference
| Command | What it does | When to use |
git worktree add <path> -b <branch> | Create a new worktree with a new branch | Starting parallel work on a new task |
git worktree list | Show all worktrees with their branches and paths | Checking what is active |
git worktree list --porcelain | Machine-readable worktree listing | Scripting or enriching with status info |
git worktree remove <path> | Remove a worktree directory and its admin files | Done with a parallel task |
git worktree remove <path> --force | Force-remove even with uncommitted changes | After explicit user confirmation |
git worktree prune | Clean up stale worktree entries | After manual directory deletion or errors |
git branch -D worktree-<name> | Delete the orphaned branch after worktree removal | Keeping branches clean |
Create
Create a new worktree for an isolated parallel development session.
Workflow
- Confirm the current directory is a git repository.
- Confirm the current session is NOT already inside a worktree:
If the current working directory is already a worktree (not the main working tree), warn the user and stop.git rev-parse --is-inside-work-tree && git worktree list - If a name was provided as an argument, use it. Otherwise, present an interactive prompt (or the platform's equivalent): "What name should I use for this worktree? (e.g.,
feature-auth,bugfix-123)" - Create the worktree:
git worktree add .worktrees/<name> -b worktree-<name> - Change your working directory to the new worktree path.
- Report to the user:
Worktree created: Directory: .worktrees/<name>/ Branch: worktree-<name> Based on: <current HEAD> - Remind the user:
- Run your stack's dependency installation command (e.g.,
composer install,npm install,pip install -r requirements.txt) - The worktree shares git history with the main repo but has its own working directory
- Use the
listcommand to see all active worktrees - Use the
removecommand to clean up when done
- Run your stack's dependency installation command (e.g.,
List
List all active worktrees with their branches, paths, and status.
Workflow
- Confirm the current directory is inside a git repository.
- Run:
git worktree list --porcelain - For each worktree, gather uncommitted change count:
git -C <worktree-path> status --short 2>/dev/null - Display a clean table:
Active worktrees: | # | Name | Branch | Path | Status | |---|--------------|----------------------|-------------------------------|---------------| | 1 | (main) | main | /path/to/repo | clean | | 2 | feature-auth | worktree-feature-auth| .worktrees/feature-auth | 3 uncommitted | | 3 | bugfix-123 | worktree-bugfix-123 | .worktrees/bugfix-123 | clean | - If no worktrees exist beyond the main working tree, say: "No additional worktrees found. Use the
createcommand to create one."
Switch
Switch your working directory to a different existing worktree.
Workflow
- Confirm the current directory is inside a git repository.
- Run:
If only the main working tree exists, say: "No worktrees available to switch to. Use thegit worktree listcreatecommand to create one." and stop. - If a name was provided as an argument, find the matching worktree path. Otherwise, show the list and present an interactive prompt (or the platform's equivalent): "Which worktree do you want to switch to?"
- If the name does not match any existing worktree, say: "Worktree
<name>not found." and show the available list. - Open a terminal in the worktree path, or switch your editor to the worktree directory.
- Report to the user:
Switched to worktree: Directory: <worktree-path> Branch: <branch-name> - Show a quick status:
git status --short
Remove
Remove one or all worktrees from the current repository.
Workflow
- Confirm the current directory is inside a git repository.
- Run:
If no worktrees exist beyond the main working tree, say: "No worktrees to clean up." and stop.git worktree list - Determine what to remove:
- If argument is
all- remove all worktrees (except the main working tree). - If a specific name was provided - remove only that worktree.
- If no argument - show the list and present an interactive prompt (or the platform's equivalent): "Which worktree should I remove? Enter the name, or type
allto remove everything."
- If argument is
- Safety check - for each worktree being removed:
If there are uncommitted changes or unpushed commits, warn the user:git -C <worktree-path> status --short git -C <worktree-path> log --oneline @{upstream}..HEAD 2>/dev/null
Wait for explicit confirmation before proceeding.WARNING: Worktree "<name>" has uncommitted changes / unpushed commits: - 2 modified files - 1 unpushed commit These will be permanently lost. Continue? (yes/no) - For each worktree to remove:
Usegit worktree remove <path> --force git branch -D worktree-<name> 2>/dev/null--forceonly after the user has confirmed in step 4. - Prune stale entries:
git worktree prune - Report what was removed:
Removed worktrees: - feature-auth (branch worktree-feature-auth deleted) - bugfix-123 (branch worktree-bugfix-123 deleted) Remaining worktrees: 1 (main working tree only)
Troubleshooting
| Problem | Cause | Fix |
fatal: '<path>' is a missing but locked worktree | Worktree directory was deleted manually but the lock file remains | Run git worktree unlock <path> then git worktree prune |
Stale entries in git worktree list | Worktree directory was deleted without using git worktree remove | Run git worktree prune to clean up admin files |
fatal: '<branch>' is already checked out | Branch is active in another worktree | Switch the other worktree to a different branch first, or remove it |
| Worktree path exists but is empty | Interrupted creation or corrupted state | Run git worktree remove <path> --force then git worktree prune |
Integration with Other Skills
| Situation | Recommended Skill |
| When managing branches and commits | git-workflow |
| When executing a TDD implementation in an isolated worktree | test-driven-development |
| When following a full ticket workflow that uses worktrees | ticket-delivery |
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

