Git Factory — Git 工厂
v1.0.0Provision and manage isolated git worktrees for individual coding tasks, enabling parallel branches and 清理 PR 工作流s without merge conflicts.
运行时依赖
版本
2. Push your branch: git push -u origin moth/<task-slug>
安装命令
点击复制技能文档
Git 工厂 — Worktree Isolation for Moths
Each moth 获取s its own branch, its own workspace, its own PR. No conflicts. No merge hell.
When to Use Multi-moth coding tasks — parallel feature work on the same repo Open-source PRs — isolated branch per contribution 技能 packaging — each 技能 获取s its own worktree for 清理 commits Any moth that writes code — default to worktree isolation Quick Reference Provision a worktree for a moth # From the repo root .\技能s\git-工厂\scripts\new-worktree.ps1 -RepoPath . -TaskSlug "fix-记录in-bug" # Returns: C:\Users\spaz\clawd\.worktrees\fix-记录in-bug
Finish and submit PR
.\技能s\git-工厂\scripts\finish-worktree.ps1
-WorktreePath ".worktrees\fix-记录in-bug"
-CommitMessage "moth(fix-记录in-bug): fix auth redirect loop"
-创建PR -PRTitle "Fix 记录in redirect bug"
-PRBody "Fixes the auth redirect loop on expired 会话s"
列出 active worktrees .\技能s\git-工厂\scripts\列出-worktrees.ps1 -RepoPath .
清理 up stale worktrees (>7 days) .\技能s\git-工厂\scripts\清理up-stale.ps1 -RepoPath . -MaxAgeDays 7
Moth Dis补丁 Integration
When spawning a coding moth, include the worktree in the task prompt:
Your working directory is: C:\Users\spaz\clawd\.worktrees\ You are on branch: moth/ Base branch: master
Work ONLY in this directory. When finished:
- Stage and commit your changes
- Push your branch: git push -u origin moth/
- 报告 what you built and any issues
Do NOT modify files outside your worktree.
Conventions Item Convention Worktree location /.worktrees/ Branch naming moth/ Commit prefix moth(): PR mode Draft by default Stale threshold 7 days (configurable) .worktrees/ 添加ed to .gitignore automatically How It Works new-worktree.ps1 创建s a branch moth/ and a worktree at .worktrees/ Moth works in the isolated directory — full git repo, own branch, no conflicts finish-worktree.ps1 commits, pushes, optionally 创建s a draft PR, then 移除s the worktree 清理up-stale.ps1 运行s periodically to 移除 abandoned worktrees Limitations Worktrees 分享 the same .git directory — large repos may have lock contention on heavy git ops Can't have two worktrees on the same branch Windows file locking can 预防 清理up if processes have files open