Install
openclaw skills install @drumrobot/git-repoGit repository and SourceGit integration. Topics — clone (ghq get + auto SourceGit register), fix-worktree (bare repo recovery), merge-duplicate (same-origin merge), to-ghq (bare+worktree → ghq, formerly migrate), to-bare (regular repo → bare + worktree, lock-aware), worktree-register (shared metadata register/relink), patrol (batch inspect), move-worktree (register / reclaim merged PR), rename-worktree (rename dir + metadata), sourcegit (preference.json), ssh-key (multi-account SSH map), worktree (inventory + reuse + create). Use when: "ghq get", "sourcegit", "ghq migrate", "repo patrol", "duplicate repo", "worktree fix", "rename worktree", "reuse worktree", "move worktree", "to bare", "convert to bare", "bare convert", "multi-account clone", "core.sshCommand", "Repository not found", "worktree create" triggers.
openclaw skills install @drumrobot/git-repoGit repository management and SourceGit GUI client integration.
| Topic | Description | Guide |
|---|---|---|
| clone | ghq get with automatic SourceGit registration (multi-account support) | clone.md |
| fix-worktree | bare repo worktree configuration recovery | fix-worktree.md |
| merge-duplicate | merge duplicate repositories with the same origin | merge-duplicate.md |
| migrate | renamed → to-ghq (backward-compat alias) | migrate.md |
| move-worktree | move/register unregistered worktrees to .claude/worktrees/, reclaim merged PR worktrees | move-worktree.md |
| patrol | batch inspection of ghq repositories (status, stash, unpushed + commit-splitter integration) | patrol.md |
| rename-worktree | rename worktree directory and metadata (cross-platform, Windows safe) | rename-worktree.md |
| sourcegit | SourceGit preference.json management (add repos, workspaces, folder rename) | sourcegit.md |
| ssh-key | per-repo SSH key mapping for multi-account GitHub (core.sshCommand + IdentityAgent) | ssh-key.md |
| to-bare | convert a regular repo → bare + worktree at a custom location, preserving uncommitted changes (inverse of to-ghq; helper: scripts/repo-to-bare-worktree.sh) | to-bare.md |
| to-ghq | migrate bare+worktree → regular .git at the ghq path (formerly migrate) | to-ghq.md |
| worktree | unified worktree acquisition: inventory, reuse inactive, or create new at .claude/worktrees/ | worktree.md |
| worktree-register | shared: register a populated directory as a worktree via metadata only (used by fix-worktree + to-bare) | worktree-register.md |
worktree (entry point — inventory + decision)
└─→ rename-worktree (reuse registered worktree)
└─→ move-worktree (register unregistered or relocate)
worktree-register (shared metadata register/relink mechanism)
├─← fix-worktree (recover a broken bare-worktree link)
└─← to-bare (link the working tree after a regular→bare conversion)
to-bare ←inverse→ to-ghq (formerly `migrate`)
Whenever a worktree is needed (plan/build/test without switching branches, PR verification, isolated work environment, new commit while main branch has another in-flight task), check for inactive worktree reuse before creating a new one.
git -C <repo> worktree list to enumerate existing worktreesrename-worktree topic (rename the directory + metadata, switch branch)git worktree addWhen committing new work on a main/master/develop branch, if git status shows uncommitted changes from another task, worktree splitting is mandatory.
git status shows 1+ changed files outside the new work (e.g., another task's unstaged files)git status (check for other changes)
├─ 0 other changes, branch = PR/feature → commit in place
├─ 0 other changes, branch = main/master/develop
│ → AskUserQuestion: (a) create PR branch from current (b) create PR branch in a new worktree
├─ 1+ other changes, branch = main/master/develop
│ → worktree split required. Leave other changes in place, isolate new work in a new worktree
└─ Another task running on a PR branch with stray changes on main
→ Report to the user (confirm intent of stray changes) → decide worktree split + stray cleanup
git -C <repo> worktree list to inspect inactive worktrees (per the decision tree above)rename-worktree; otherwise git -C <repo> worktree add .claude/worktrees/<branch> (or the worktree path defined by the active environment context — see worktree.md "Default Path Rules")git checkout -b <new-branch> (or use the existing inactive branch)| # | Don't | Do |
|---|---|---|
| 1 | main has other changes; add the new file + commit + push anyway | Run git status → if other changes exist → split into a worktree → commit in the new worktree |
| 2 | Hide other changes with git stash and commit on main | stash breaks the other task's intent/sequence. Worktree split is safer |
| 3 | Assume "my changes only — no conflict" | Other working-directory changes can spill over (tests, builds, IDE state) |
| 4 | Omit "worktree split" from the AskUserQuestion commit options | If branch is main/master/develop and other changes exist, "split into worktree + create PR branch" must be the first option |
| # | Don't | Do |
|---|---|---|
| 1 | Default to git worktree add <path> <branch> whenever a worktree is needed | git worktree list first → check inactive candidates → consider rename-worktree |
| 2 | "Temporary verification — create new and delete" pattern (wastes resources) | Reuse a merged-PR worktree (e.g., one stuck at the merge commit) via rename |
| 3 | AskUserQuestion options offer only "create new worktree" | Include "reuse an existing worktree by rename" whenever an inactive worktree exists |
| 4 | Decide on the worktree autonomously before asking the user | When inactive candidates exist, ask which one to reuse |
| 5 | Ignore merged-PR worktrees | Reclaim them with move-worktree or rename-worktree |
| 6 | Place "create new worktree" as option 1/Recommended when inactive candidates exist | Reuse is Recommended/option 1. New is option 2 or below |
| 7 | "Unknown purpose for the inactive candidate → recommend safe new" thinking | Inspect the inactive candidate state (git log, git status) first. If still ambiguous, ask the user which to reuse — but keep reuse as option 1 |
When building AskUserQuestion options for worktree selection:
| Inactive candidates | Option order + Recommended |
|---|---|
| 0 | Option 1: New worktree (Recommended). Option 2: Hold |
| 1 | Option 1: Reuse inactive by rename (Recommended). Option 2: New worktree. Option 3: Hold |
| 2+ | Option 1: Rename inactive A (Recommended). Option 2: Rename inactive B. Option 3: New worktree. Option 4: Hold |
The Recommended marker must attach to the reuse option. "Safer to default to new because purpose is unclear" is an autonomous judgment — instead, document the "verify current commit/branch before reuse" procedure in the rename option description so the user can decide.
git -C <repo> worktree list?When a worktree is needed for plan verification, defaulting to "create new + remove later" wastes resources. git worktree list often shows merged-PR worktrees stuck on the merge commit hash — these are reuse candidates. Always inventory first before creating a new worktree.
When ghq get <url> is executed, the following happens automatically:
Proceeds automatically without user confirmation
Directly edit the SourceGit GUI client's configuration file to add repositories, create workspaces, rename folders, etc.
Key features:
migrate): bare+worktree → regular .git at the ghq path (~/ghq/host/group/repo/). Auto bare+worktree conversion, optional symlink, nested groups. Detailed guide.claude/worktrees/), preserving uncommitted changes. Includes a Windows lock pre-check (SourceGit/VS Code handle on .git blocks the rename). Detailed guideBatch inspect and clean up the status of repositories under ghq.
Key features:
to-ghq topic (or to-bare for the inverse)sourcegit topicpatrol topic./scripts/repo-to-ghq.sh - Move a repository to the ghq path (bare+worktree → regular)./scripts/repo-to-bare-worktree.sh - Convert a regular repo → bare + worktree (inverse)