git-worktrees
Skill2 starsChanged 40 days agoMITView on GitHub
Effective git worktree workflows for agents and humans: branches vs worktrees, safe commit-then-merge integration (never cp into main checkout), conflict handling, when to use or skip worktrees, macOS concurrency, and disk hygiene for global ~/.grok/worktrees/ clones. Use when creating worktrees, integrating agent task branches, or cleaning up after large orchestration runs.
24 other projects use a version of this.
Adopted by
Most recently taken up by
- jeanqussa/hermes-generic-opstheir own version, first seen Nov 8, 2026
- denormans/claude-code-workflowtheir own version, first seen Nov 8, 2026
- kazemcodes/skill-treetheir own version, first seen Nov 8, 2026
- Mahesh-Bishnoi/skillstheir own version, first seen Nov 8, 2026
- bostonaholic/rpikittheir own version, first seen Nov 8, 2026
- gabrielkoerich/skillstheir own version, first seen Nov 1, 2026
Used with
Projects with it also use obsidian-bases, verification-before-completion and 10 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
wangzhuofengSkillobsidian-bases
Create and edit Obsidian Bases (.base files) with views, filters, formulas, and summaries. Use when working with .base files, creating database-like views of notes, or when the user mentions Bases, table views, card views, filters, or formulas in Obsidian.
Also in 3 projects that use this
OpenAISkillverification-before-completion
Use when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always
Also in 4 projects that use this
SentrySkillsecurity-review
Finds exploitable application security vulnerabilities in code changes. Use for Warden security scans, appsec review, OWASP-style checks, authentication or authorization bugs, injection, XSS, SSRF, path traversal, secrets, unsafe crypto, webhook verification, open redirects, or sensitive data exposure.
Also in 4 projects that use this
OpenAISkillsystematic-debugging
Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes
Also in 4 projects that use this
CloudflareSkillreceiving-code-review
Use when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performative agreement or blind implementation
Also in 3 projects that use this
CloudflareSkillsecurity-audit
Security guidance and vulnerability review for codebases, APIs, services, CLI tools, libraries, and daemons. Use for security questions, focused reviews, vulnerability research, security audits, or pen tests. Run the complete workflow only for explicit codebase audit or pen-test requests, full/comprehensive/end-to-end reviews, or requested report artifacts.
Also in 3 projects that use this
- +3 more from openai
Other versions24 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 24
- heyitsnoah/claudesidian★ 2.6ksame name
- jamesrochabrun/skills★ 209same name
- trailofbits/dropkit★ 129same name
- bostonaholic/rpikit★ 19same name
- CarbeneAI/Forge★ 9same name
- sergeeey/Claude-cod-top-2026★ 9same name
- gabrielkoerich/skills★ 8same name
- tstapler/dotfiles★ 8same name
- KhaledSaeed18/dotclaude★ 5same name
- vikisingh23/neuraforge-ai★ 4same name
14 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository49 other files it gives its agents.
- AGENTS.mdAGENTS.md
- adversarial-auditSkill
- agentic-reactorSkill
- agent-orchestratorSkill
- ai-optimizationSkill
- architecture-synthesisSkill
- audit-allow-buildsSkill
- audit-ide-dependenciesSkill
- author-workflow-skillSkill
- bdd-strategizerSkill
- chrome-extension-mv3Skill
- concurrent-cli-agentsSkill
- control-feederSkill
- control-graphSkill
- cursor-transcript-harvestSkill
- cv-promote-guardSkill
- devcontainer-hardenedSkill
- dual-copy-skill-publishSkill
- explore-repo-readonlySkill
- finder-reactorSkill
- fix-dependency-securitySkill
- fusion-sageSkill
- grok-host-prepSkill
- gt-flowSkill
- higher-order-decision-architectSkill
- looperSkill
- master-plannerSkill
- mvu-refactor-planSkill
- odysseus-navigatorSkill
- project-editor-profileSkill
- react-client-expertSkill
- semantic-markup-cssSkill
- semantic-nameSkill
- session-unit-orderSkill
- shell-kernel-ontologySkill
- skill-rename-propagationSkill
- split-to-prsSkill
- src-tree-reorganizeSkill
- stellar-roadmapSkill
- stellar-spacemapSkill
- subagent-delegationSkill
- subagent-explore-reportSkill
- supply-chain-hardenSkill
- tauri-agenticSkill
- tauri-ipc-debugSkill
- tidy-commit-pushSkill
- upgrade-packagesSkill
- verification-cockpitSkill
- x-agent-resourcesSkill
The file
We split this skill into the rules it gives an agent
1 rule. 0 are common, 0 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 24 edited versions we read keep these.
0
Distinctive
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 75
If linear history without merge commits: still commit in each WT, then cherry-pick.
“Common” is measured: kept by at least 6 in 10 of the 24 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
git-worktrees
Load rule: Formal SoT. Disk/Grok CLI detail → references/disk-hygiene.md only if needed.
CLT: ../rules/clt-dual-load.mdc — one agent per worktree enables safe fan-out (asymmetric parallel); never merge viacp.
// Signature
branch ≔ *what* (line of commits)
worktree ≔ *where* (extra checkout on same .git)
// Axioms
A1 Integrate = commit in WT → merge/cherry-pick on integration — never cp/rsync
A2 One agent ⇔ one worktree directory
A3 Remove WT only after merge + verify (or explicit abandon)
A4 Concurrent add on macOS: stagger (sleep ~1s) to avoid index SIGBUS
A5 Two layers: repo-local .worktrees/ vs global ~/.grok/worktrees/ full clones
A6 After large plans: hygiene mandatory (see disk-hygiene)Pair: concurrent-cli-agents · agent-orchestrator · split-to-prs.
Use / skip
| Use when | Prefer instead when |
| ≥2 tasks same repo concurrent | single task → one checkout |
| long feature + main for hotfixes | unrelated repos → separate clones |
| side-by-side run/compare | never touch disk → cloud sandbox |
| agent isolation | same few files always → serialize (WT ≠ less conflict) |
disk tight + heavy node_modules → serialize or /tmp clones |
This library convention: .worktrees/<tool>-<slug> · branch agent/<tool>/<slug> · create via concurrent-cli-agents script when present.
Safe integration
1. Agent only inside its WT path
2. Validate in that WT
3. git commit on agent/<tool>/<slug>
4. Orch on primary: integration branch checked out
5. Merge one branch at a time → resolve on primary → re-validate
6. Remove WT after success# merge agent branch onto current (primary)
<path>/git-worktrees/scripts/agent-worktree-merge.sh --branch agent/cursor/<slug>Merge order: docs/low-churn first, then code.
Why never cp
| Risk | Failure |
| last writer wins | silent drop of other task |
| stale copy | half-finished files |
| lost work | uncommitted + force-remove |
| no audit | no per-task commits/PRs |
If linear history without merge commits: still commit in each WT, then cherry-pick.
Coordinator checklist
[ ] create WT+branch per task (stagger on macOS)
[ ] disjoint files in prompts
[ ] agent commits before "done"
[ ] git worktree list ↔ branch
[ ] merge one-by-one on primary
[ ] conflicts only on primary
[ ] validate integration
[ ] remove WT; optional branch -d
[ ] large plans → disk hygieneScripts
| Script | Purpose |
concurrent-cli-agents agent-worktree-create.sh | new WT + branch |
scripts/agent-worktree-list.sh | list |
scripts/agent-worktree-merge.sh | merge one agent branch |
scripts/agent-worktree-remove.sh | remove after merge |
scripts/agent-worktree-clean.sh | Grok global cleanup + branch preserve |
Conflicts
Primary checkout only · fix · git add · merge --continue · re-validate.
Heavy conflict → abort, rebase smaller task onto merged result.
Anti-patterns
| ¬ | Do |
cp/rsync integrate | merge/cherry-pick |
| commit integration while agents still edit same files | serialize or disjoint |
worktree remove --force pre-merge | merge first |
| two agents one WT dir | one WT each |
| WT without commits | branch+commit |
| delete agent/* before on target | merge first |
leave ~/.grok/worktrees/ orphans | gc / clean.sh |
Stack/handoff naming: see agent-orchestrator + gt-flow; artificial final branch names.
Done when: agent commits on their branch; integration via merge; hygiene run after multi-WT plans.
Disk/Grok CLI: references/disk-hygiene.md.
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.

