{"id":"21e3f478-316e-465c-8f0f-150f89cebaa6","entityType":"agent","slug":"clawhub-drumrobot-git-repo","name":"git-repo","canonicalUrl":"https://www.xpersona.co/agent/clawhub-drumrobot-git-repo","canonicalPath":"/agent/clawhub-drumrobot-git-repo","generatedAt":"2026-10-09T11:35:59.290Z","source":"CLAWHUB","claimStatus":"UNCLAIMED","verificationTier":"NONE","summary":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-10-09T11:24:21.942Z","emptyReason":null},"description":"Git repository and SourceGit integration. Topics — clone (ghq), conflict-dry-run (isolated merge test), credential-helper (multi-account HTTPS token), doctor (hook health & compliance audit — Tier 1 Base + Tier 2 Conditional taxonomy), fix-worktree (bare repo recovery), githooks (hook silently never runs — hooksPath precedence, passthrough chain, install trade-off), isolate-hunk (stage own edit amid unrelated content), merge-duplicate, rebase-audit (accidental-revert detection during an active rebase), to-ghq (formerly migrate), to-bare, worktree-register (metadata register/relink), patrol (batch inspect), move-worktree (register/reclaim merged PR), rename-worktree, safe-relocate (relocate commits onto a clean base branch), sourcegit, ssh-key (multi-account SSH map), worktree (inventory + reuse + create), worktree-drift-sync (mirror fix across worktrees safely). Use when: \"reuse worktree\", \"multi-account clone\", \"Repository not found\", \"wrong account\", \"concurrent uncommitted edit\", \"accidental revert\", \"githooks ignored\", \"hook not running\", \"core.hooksPath\", \"hook not firing\", \"repo doctor\", \"hook health\", \"diagnose hooks\", \"check hooks\" triggers.","descriptionLabel":"Source description","evidenceSummary":"Capability contract not published. No trust telemetry is available yet. 2.8K downloads reported by the source. Last updated 10/9/2026.","installCommand":"clawhub skill install s17ay1v6v88r2m102pvvc44gz183qcrm:git-repo","sourceUrl":"https://clawhub.ai/drumrobot/git-repo","homepage":"https://clawhub.ai/drumrobot/skills/git-repo","primaryLinks":[{"label":"View on ClawHub","url":"https://clawhub.ai/drumrobot/git-repo","kind":"source"},{"label":"Homepage","url":"https://clawhub.ai/drumrobot/skills/git-repo","kind":"homepage"}],"safetyScore":84,"overallRank":62,"popularityScore":40,"trustScore":null,"claimedByName":null,"isOwner":false,"seoDescription":"git-repo technical dossier on Xpersona with agent coverage, OPENCLEW support, and live trust metadata."},"coverage":{"evidence":{"source":"public-profile","verified":false,"confidence":"medium","updatedAt":"2026-10-09T11:24:21.942Z","emptyReason":null},"protocols":[{"protocol":"OPENCLEW","label":"OpenClaw","status":"self-declared","notes":"Declared in the public agent profile."}],"capabilities":[],"verifiedCount":0,"selfDeclaredCount":1,"capabilityMatrix":{"rows":[{"key":"OPENCLEW","type":"protocol","support":"unknown","confidenceSource":"profile","notes":"Listed on profile"}],"flattenedTokens":"protocol:OPENCLEW|unknown|profile"}},"adoption":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-10-09T11:24:21.942Z","emptyReason":null},"stars":null,"forks":null,"downloads":2811,"packageName":null,"latestVersion":"0.13.0","tractionLabel":"2.8K downloads"},"release":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-10-09T11:24:21.942Z","emptyReason":null},"lastUpdatedAt":"2026-10-09T11:24:21.942Z","lastCrawledAt":"2026-10-09T11:24:21.942Z","lastIndexedAt":null,"nextCrawlAt":"2026-10-10T11:24:21.942Z","lastVerifiedAt":null,"highlights":[{"version":"0.13.0","createdAt":"2026-10-09T10:54:11.385Z","changelog":"## git-repo 0.13.0 - Added and updated scripts for improved worktree pruning (`prune_merged_worktrees.py` and tests). - Updated documentation (CHANGELOG.md). - Removed obsolete file: `skill-card.md`.","fileCount":39,"zipByteSize":116562},{"version":"0.12.1","createdAt":"2026-10-06T07:55:56.402Z","changelog":"- Added new \"safe-relocate\" topic and guide for moving commits onto a clean base branch - Removed obsolete file: skill-card.md - Updated documentation and topic tables to include the new \"safe-relocate\" command - Minor content and structure improvements across guides and topic dependencies","fileCount":39,"zipByteSize":116006},{"version":"0.12.0","createdAt":"2026-09-24T14:19:37.977Z","changelog":"- Added script to prune merged worktrees: `scripts/prune_merged_worktrees.py`. - Added corresponding test: `tests/test_prune_merged_worktrees.py`. - Updated documentation in `SKILL.md` and `CHANGELOG.md`. - Removed deprecated or obsolete file: `skill-card.md`.","fileCount":39,"zipByteSize":113153},{"version":"0.11.1","createdAt":"2026-09-18T15:53:28.175Z","changelog":"- Added new and updated tests for git-repo-doctor.sh to improve test coverage and reliability. - Made changes to the scripts/git-repo-doctor.sh script (details not shown). - Updated documentation in CHANGELOG.md. - Removed obsolete skill-card.md file.","fileCount":37,"zipByteSize":105312},{"version":"0.11.0","createdAt":"2026-09-06T10:31:33.332Z","changelog":"- Improved repository doctor script and documentation for diagnosing git hook health and CI compliance. - Updated doctor.md usage details to match enhancements in scripts/git-repo-doctor.sh. - Removed obsolete skill-card.md file. - General documentation refinements for clarity and consistency.","fileCount":37,"zipByteSize":103955},{"version":"0.10.1","createdAt":"2026-09-01T22:37:58.734Z","changelog":"- Removed deprecated `skill-card.md` file. - Updated and clarified guides: `doctor.md`, `rebase-audit.md`, `rename-worktree.md`. - Improved and expanded the scripts: `scripts/git-repo-doctor.sh`, `tests/test-git-repo-doctor.sh`. - Updated CHANGELOG.md with recent changes. - Documentation and health-check improvements for the \"doctor\" feature.","fileCount":37,"zipByteSize":103673},{"version":"0.10.0","createdAt":"2026-08-30T11:13:30.965Z","changelog":"**New feature: Comprehensive Git repository hook health check (doctor)** - Added \"doctor\" topic for diagnosing Git repository hook health, wiring, file permissions, and CI compliance (Base + Conditional taxonomy). - Introduced `doctor.md` guide and supporting scripts for automated repository checks. - Updated documentation to include new \"doctor\" capabilities and troubleshooting triggers. - Removed obsolete \"skill-card.md\" file. - Expanded tests to cover the new \"doctor\" functionality.","fileCount":37,"zipByteSize":97985},{"version":"0.9.1","createdAt":"2026-08-26T17:25:57.963Z","changelog":"- Removed skill-card.md (retired file). - Updated internal documentation in multiple guides: clone.md, to-bare.md, to-ghq.md, and worktree.md. - Minor corrections and refinements made to guide content and topic descriptions. - No new user-facing features or major functionality changes.","fileCount":34,"zipByteSize":87281}]},"execution":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No published capability contract is available yet."},"installCommand":"clawhub skill install s17ay1v6v88r2m102pvvc44gz183qcrm:git-repo","setupComplexity":"low","setupSteps":["Install using `clawhub skill install s17ay1v6v88r2m102pvvc44gz183qcrm:git-repo` in an isolated environment before connecting it to live workloads.","No published capability contract is available yet, so validate auth and request/response behavior manually.","Review the upstream CLAWHUB listing at https://clawhub.ai/drumrobot/git-repo before using production credentials."],"contract":{"contractStatus":"missing","authModes":[],"requires":[],"forbidden":[],"supportsMcp":false,"supportsA2a":false,"supportsStreaming":false,"inputSchemaRef":null,"outputSchemaRef":null,"dataRegion":null,"contractUpdatedAt":null,"sourceUpdatedAt":null,"freshnessSeconds":null},"invocationGuide":{"preferredApi":{"snapshotUrl":"https://www.xpersona.co/api/v1/agents/clawhub-drumrobot-git-repo/snapshot","contractUrl":"https://www.xpersona.co/api/v1/agents/clawhub-drumrobot-git-repo/contract","trustUrl":"https://www.xpersona.co/api/v1/agents/clawhub-drumrobot-git-repo/trust"},"curlExamples":["curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-drumrobot-git-repo/snapshot\"","curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-drumrobot-git-repo/contract\"","curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-drumrobot-git-repo/trust\""],"jsonRequestTemplate":{"query":"summarize this repo","constraints":{"maxLatencyMs":2000,"protocolPreference":["OPENCLEW"]}},"jsonResponseTemplate":{"ok":true,"result":{"summary":"...","confidence":0.9},"meta":{"source":"CLAWHUB","generatedAt":"2026-10-09T11:35:59.287Z"}},"retryPolicy":{"maxAttempts":3,"backoffMs":[500,1500,3500],"retryableConditions":["HTTP_429","HTTP_503","NETWORK_TIMEOUT"]}},"endpoints":{"dossierUrl":"https://www.xpersona.co/api/v1/agents/clawhub-drumrobot-git-repo/dossier","snapshotUrl":"https://www.xpersona.co/api/v1/agents/clawhub-drumrobot-git-repo/snapshot","contractUrl":"https://www.xpersona.co/api/v1/agents/clawhub-drumrobot-git-repo/contract","trustUrl":"https://www.xpersona.co/api/v1/agents/clawhub-drumrobot-git-repo/trust"}},"reliability":{"evidence":{"source":"runtime-metrics","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No trust, reliability, or runtime telemetry is available."},"trust":{"status":"unavailable","handshakeStatus":"UNKNOWN","verificationFreshnessHours":null,"reputationScore":null,"p95LatencyMs":null,"successRate30d":null,"fallbackRate":null,"attempts30d":null,"trustUpdatedAt":null,"trustConfidence":"unknown","sourceUpdatedAt":null,"freshnessSeconds":null},"decisionGuardrails":{"doNotUseIf":["Contract metadata is missing or unavailable for deterministic execution."],"safeUseWhen":[],"riskFlags":["missing_or_unavailable_contract","trust_data_unavailable","schema_references_missing"],"operationalConfidence":"low"},"executionMetrics":{"observedLatencyMsP50":null,"observedLatencyMsP95":null,"estimatedCostUsd":null,"uptime30d":null,"rateLimitRpm":null,"rateLimitBurst":null,"lastVerifiedAt":null,"verificationSource":null},"runtimeMetrics":{"successRate":null,"avgLatencyMs":null,"avgCostUsd":null,"hallucinationRate":null,"retryRate":null,"disputeRate":null,"p50Latency":null,"p95Latency":null,"lastUpdated":null}},"benchmarks":{"evidence":{"source":"no-benchmark-data","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No benchmark suites or observed failure patterns are available."},"suites":[],"failurePatterns":[]},"artifacts":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-10-09T11:24:21.942Z","emptyReason":null},"readme":"Skill: git-repo\n\nOwner: drumrobot\n\nSummary: Git repository and SourceGit integration. Topics — clone (ghq), conflict-dry-run (isolated merge test), credential-helper (multi-account HTTPS token), doctor (hook health & compliance audit — Tier 1 Base + Tier 2 Conditional taxonomy), fix-worktree (bare repo recovery), githooks (hook silently never runs — hooksPath precedence, passthrough chain, install trade-off), isolate-hunk (stage own edit amid unrelated content), merge-duplicate, rebase-audit (accidental-revert detection during an active rebase), to-ghq (formerly migrate), to-bare, worktree-register (metadata register/relink), patrol (batch inspect), move-worktree (register/reclaim merged PR), rename-worktree, safe-relocate (relocate commits onto a clean base branch), sourcegit, ssh-key (multi-account SSH map), worktree (inventory + reuse + create), worktree-drift-sync (mirror fix across worktrees safely). Use when: \"reuse worktree\", \"multi-account clone\", \"Repository not found\", \"wrong account\", \"concurrent uncommitted edit\", \"accidental revert\", \"githooks ignored\", \"hook not running\", \"core.hooksPath\", \"hook not firing\", \"repo doctor\", \"hook health\", \"diagnose hooks\", \"check hooks\" triggers.\n\nTags: latest:0.13.0\n\nVersion history:\n\nv0.13.0 | 2026-10-09T10:54:11.385Z | auto\n\n## git-repo 0.13.0\n\n- Added and updated scripts for improved worktree pruning (`prune_merged_worktrees.py` and tests).\n- Updated documentation (CHANGELOG.md).\n- Removed obsolete file: `skill-card.md`.\n\nv0.12.1 | 2026-10-06T07:55:56.402Z | auto\n\n- Added new \"safe-relocate\" topic and guide for moving commits onto a clean base branch\n- Removed obsolete file: skill-card.md\n- Updated documentation and topic tables to include the new \"safe-relocate\" command\n- Minor content and structure improvements across guides and topic dependencies\n\nv0.12.0 | 2026-09-24T14:19:37.977Z | auto\n\n- Added script to prune merged worktrees: `scripts/prune_merged_worktrees.py`.\n- Added corresponding test: `tests/test_prune_merged_worktrees.py`.\n- Updated documentation in `SKILL.md` and `CHANGELOG.md`.\n- Removed deprecated or obsolete file: `skill-card.md`.\n\nv0.11.1 | 2026-09-18T15:53:28.175Z | auto\n\n- Added new and updated tests for git-repo-doctor.sh to improve test coverage and reliability.\n- Made changes to the scripts/git-repo-doctor.sh script (details not shown).\n- Updated documentation in CHANGELOG.md.\n- Removed obsolete skill-card.md file.\n\nv0.11.0 | 2026-09-06T10:31:33.332Z | auto\n\n- Improved repository doctor script and documentation for diagnosing git hook health and CI compliance.\n- Updated doctor.md usage details to match enhancements in scripts/git-repo-doctor.sh.\n- Removed obsolete skill-card.md file.\n- General documentation refinements for clarity and consistency.\n\nv0.10.1 | 2026-09-01T22:37:58.734Z | auto\n\n- Removed deprecated `skill-card.md` file.\n- Updated and clarified guides: `doctor.md`, `rebase-audit.md`, `rename-worktree.md`.\n- Improved and expanded the scripts: `scripts/git-repo-doctor.sh`, `tests/test-git-repo-doctor.sh`.\n- Updated CHANGELOG.md with recent changes.\n- Documentation and health-check improvements for the \"doctor\" feature.\n\nv0.10.0 | 2026-08-30T11:13:30.965Z | auto\n\n**New feature: Comprehensive Git repository hook health check (doctor)**\n\n- Added \"doctor\" topic for diagnosing Git repository hook health, wiring, file permissions, and CI compliance (Base + Conditional taxonomy).\n- Introduced `doctor.md` guide and supporting scripts for automated repository checks.\n- Updated documentation to include new \"doctor\" capabilities and troubleshooting triggers.\n- Removed obsolete \"skill-card.md\" file.\n- Expanded tests to cover the new \"doctor\" functionality.\n\nv0.9.1 | 2026-08-26T17:25:57.963Z | auto\n\n- Removed skill-card.md (retired file).\n- Updated internal documentation in multiple guides: clone.md, to-bare.md, to-ghq.md, and worktree.md.\n- Minor corrections and refinements made to guide content and topic descriptions.\n- No new user-facing features or major functionality changes.\n\nv0.9.0 | 2026-08-21T05:41:03.114Z | auto\n\n- Added new `githooks` topic for diagnosing hooks not firing due to hooksPath precedence and install methods, with a dedicated guide.\n- Expanded troubleshooting triggers and usage descriptions to cover githooks issues: \"githooks ignored\", \"hook not running\", \"core.hooksPath\", \"hook not firing\".\n- Updated worktree decision tree to include detection and handling of squash-merged PR worktrees using GitHub PR state, not just commit hashes.\n- Removed outdated `skill-card.md`, reflecting structural guide changes.\n- Minor improvements and clarifications across documentation topics and guides.\n\nv0.8.1 | 2026-08-18T05:41:43.730Z | auto\n\ngit-repo v0.8.1\n\n- Updated documentation for worktree and rename-worktree topics.\n- Improved and clarified usage instructions in rename-worktree.md and worktree.md.\n- Minor script adjustments in scripts/rename-worktree.sh to improve reliability.\n- Removed obsolete skill-card.md file.\n\nv0.8.0 | 2026-08-17T12:07:10.058Z | auto\n\n- Added two new topics: `rebase-audit` (audit active interactive rebases for accidental reverts) and `worktree-drift-sync` (coordinate safe fixes across multiple worktrees).\n- Updated topic descriptions for improved clarity and conciseness.\n- Removed `skill-card.md` file, streamlining documentation.\n- Updated documentation references to include new topics and reflect latest workflow patterns.\n\nv0.7.2 | 2026-08-09T14:11:24.212Z | auto\n\n- Added scripts/check-worktree-canonical.sh and accompanying automated test (tests/test-check-worktree-canonical.sh) for worktree canonical path verification.\n- Updated documentation for move-worktree, rename-worktree, and worktree topics.\n- Improved or fixed scripts/stage-isolated-content.sh.\n- Removed obsolete skill-card.md file.\n\nv0.7.1 | 2026-08-06T09:21:44.627Z | auto\n\n- Updated documentation in `CHANGELOG.md` and `worktree.md`.\n- Removed `skill-card.md` file.\n- No changes to core features or interface.\n\nv0.7.0 | 2026-08-04T07:32:52.775Z | auto\n\n## git-repo 0.7.0\n\n- Added \"isolate-hunk\" topic: enables staging only your own edit in a file with mixed uncommitted changes, using git plumbing.\n- New guide: `isolate-hunk.md` and helper script: `scripts/stage-isolated-content.sh`.\n- Updated SKILL.md to document the \"isolate-hunk\" capability and user triggers.\n- Improved worktree and staging workflows documentation.\n- Removed deprecated `skill-card.md` file.\n\nv0.6.1 | 2026-07-28T23:09:51.055Z | auto\n\n- Removed obsolete skill-card.md file.\n- Updated documentation in CHANGELOG.md, SKILL.md, scripts/local-to-staging-pr.sh, and worktree.md for clarity and accuracy.\n- No user-facing feature changes; update is documentation and cleanup only.\n\nv0.6.0 | 2026-07-23T13:39:28.171Z | auto\n\nVersion 0.6.0\n\n- Added new topics: conflict-dry-run (isolated merge/cherry-pick test) and credential-helper (per-org HTTPS token management).\n- Updated SKILL.md description and topic table to include new topics and usage triggers.\n- Expanded worktree reuse rules with an \"operation-state gate\" to prevent unsafe reuse of worktrees involved in in-progress git operations.\n- Documented SSH/HTTPS multi-account support split between ssh-key and credential-helper.\n- Removed outdated file: skill-card.md.\n\nv0.5.0 | 2026-07-19T05:39:00.585Z | auto\n\n## git-repo 0.5.0\n\n- Added `scripts/local-to-staging-pr.sh` utility script.\n- Updated guides and documentation for worktree operations: `rename-worktree.md`, `worktree.md`, and others.\n- Improved or clarified CHANGELOG.md and SKILL.md documentation.\n- Removed deprecated `skill-card.md` file.\n\nv0.4.3 | 2026-07-16T12:29:55.544Z | auto\n\n- Added README.md with documentation overview.\n- Updated and clarified guides: CHANGELOG.md, rename-worktree.md, worktree-register.md, worktree.md.\n- Improved scripts/rename-worktree.sh for reliability and clarity.\n- Documentation improvements and refactoring across major topics.\n\nv0.4.2 | 2026-06-26T16:24:14.006Z | auto\n\n- Removed skill-card.md to streamline documentation.\n- Updated scripts/repo-to-bare-worktree.sh (details not shown here; possible script improvements or bug fixes).\n- Minor documentation or changelog updates.\n\nv0.4.1 | 2026-06-19T23:10:46.618Z | auto\n\n- Improves worktree management scripts for better reliability and cross-platform compatibility.\n- Updates `rename-worktree.md` and related scripts for enhanced directory and metadata rename workflows.\n- Removes outdated documentation file (`skill-card.md`).\n- Updates CHANGELOG and topic guides for clarity and alignment with current functionality.\n\nv0.4.0 | 2026-06-12T15:36:43.064Z | auto\n\n**Major: Bare repo and migration workflow rework; new conversion and registration topics.**\n\n- Added \"to-bare\" topic: convert regular repo to bare+worktree setup, preserving uncommitted changes.\n- Added \"to-ghq\" topic: migrate bare+worktree to regular `.git` at the ghq path (was \"migrate\"; now an alias).\n- Introduced \"worktree-register\" shared topic for metadata-based worktree registration, used by fix-worktree and to-bare.\n- Added guides: to-bare.md, to-ghq.md, worktree-register.md; new bare conversion script.\n- Updated documentation and topic table to clarify dependencies and migration flow.\n- Removed obsolete guide (skill-card.md); marked \"migrate\" as deprecated in favor of \"to-ghq\".\n\nv0.3.2 | 2026-06-07T07:57:26.577Z | auto\n\n- Shortened and clarified the SKILL.md description for easier understanding.\n- Removed redundant/verbose trigger and topic keyword lists from the SKILL.md header.\n- Minor formatting improvements for topic list and guides.\n- Removed the obsolete `skill-card.md` file.\n\nv0.3.1 | 2026-06-03T12:13:01.663Z | auto\n\n- Updated documentation in CHANGELOG.md and ssh-key.md.\n- Removed the skill-card.md file.\n- No functional or code changes; documentation only.\n\nv0.3.0 | 2026-05-27T08:50:13.817Z | auto\n\n## git-repo v0.3.0\n\n- Added comprehensive worktree management: unified worktree workflow, inactive worktree reuse, move/reclaim, and cross-platform renaming.\n- Introduced per-repo SSH key mapping for multi-account GitHub support via `ssh-key` topic.\n- Added new topics: `move-worktree`, `rename-worktree`, and `worktree`; included detailed guides for each.\n- Worktree workflow now recommends reuse before creating new, with clear user decision flow.\n- Expanded documentation and guides for all new topics and workflows.\n- Added utility scripts for worktree movement and renaming.\n\nv0.1.2 | 2026-04-15T02:42:32.266Z | user\n\nAdd fix-worktree topic for bare repo worktree configuration recovery\n\nv0.1.1 | 2026-04-12T13:23:43.401Z | user\n\nBump metadata version to 0.1.1\n\nv0.1.0 | 2026-03-31T04:43:16.769Z | user\n\nInitial release: clone, fix-worktree, merge-duplicate, migrate, patrol, sourcegit\n\nArchive index:\n\nArchive v0.13.0: 39 files, 116562 bytes\n\nFiles: CHANGELOG.md (17392b), clone.md (5209b), conflict-dry-run.md (5735b), credential-helper.md (6730b), doctor.md (13778b), fix-worktree.md (2263b), githooks.md (6504b), isolate-hunk.md (4551b), LICENSE (1063b), merge-duplicate.md (2710b), migrate.md (459b), move-worktree.md (5485b), patrol.md (6071b), README.md (597b), rebase-audit.md (13511b), rename-worktree.md (9791b), safe-relocate.md (2570b), scripts/check-worktree-canonical.sh (6008b), scripts/git-fix-worktree.sh (2513b), scripts/git-repo-doctor.sh (18660b), scripts/local-to-staging-pr.sh (8829b), scripts/prune_merged_worktrees.py (15841b), scripts/rename-worktree.sh (6840b), scripts/repo-to-bare-worktree.sh (5118b), scripts/repo-to-ghq.sh (7470b), scripts/stage-isolated-content.sh (2441b), skill-card.md (1879b), SKILL.md (17522b), sourcegit.md (5456b), ssh-key.md (5244b), tests/test_prune_merged_worktrees.py (8813b), tests/test-check-worktree-canonical.sh (3791b), tests/test-git-repo-doctor.sh (18680b), to-bare.md (4235b), to-ghq.md (6532b), worktree-drift-sync.md (3736b), worktree-register.md (4216b), worktree.md (40103b), _meta.json (128b)\n\nFile v0.13.0:SKILL.md\n\n---\nname: git-repo\nmetadata:\n  author: es6kr\n  version: \"0.1.2\"\ndepends-on:\n  - commit-tidy\ndescription: |\n  Git repository and SourceGit integration. Topics — clone (ghq), conflict-dry-run (isolated merge test), credential-helper (multi-account HTTPS token), doctor (hook health & compliance audit — Tier 1 Base + Tier 2 Conditional taxonomy), fix-worktree (bare repo recovery), githooks (hook silently never runs — hooksPath precedence, passthrough chain, install trade-off), isolate-hunk (stage own edit amid unrelated content), merge-duplicate, rebase-audit (accidental-revert detection during an active rebase), to-ghq (formerly migrate), to-bare, worktree-register (metadata register/relink), patrol (batch inspect), move-worktree (register/reclaim merged PR), rename-worktree, safe-relocate (relocate commits onto a clean base branch), sourcegit, ssh-key (multi-account SSH map), worktree (inventory + reuse + create), worktree-drift-sync (mirror fix across worktrees safely). Use when: \"reuse worktree\", \"multi-account clone\", \"Repository not found\", \"wrong account\", \"concurrent uncommitted edit\", \"accidental revert\", \"githooks ignored\", \"hook not running\", \"core.hooksPath\", \"hook not firing\", \"repo doctor\", \"hook health\", \"diagnose hooks\", \"check hooks\" triggers.\nallowed-tools:\n  - Read\n  - Edit\n  - Write\n  - Bash(ghq:*)\n  - Bash(git:*)\n  - Bash(mv:*)\n  - Bash(ls:*)\n  - Bash(pgrep:*)\n  - Bash(cat:*)\n---\n\n# Git Repo\n\nGit repository management and SourceGit GUI client integration.\n\n## Topics\n\n| Topic | Description | Guide |\n|-------|-------------|-------|\n| clone | ghq get with automatic SourceGit registration (multi-account support) | [clone.md](./clone.md) |\n| conflict-dry-run | test merge/cherry-pick applicability in an isolated worktree, without touching the main working tree | [conflict-dry-run.md](./conflict-dry-run.md) |\n| credential-helper | pin a per-org GitHub token for HTTPS remotes (fixes recurring `Repository not found` from active-account mismatch); HTTPS counterpart to ssh-key | [credential-helper.md](./credential-helper.md) |\n| doctor | diagnose Git repository hook health, wiring, permissions, and CI compliance (Base universal + Conditional domain/type taxonomy; helper: `scripts/git-repo-doctor.sh`) | [doctor.md](./doctor.md) |\n| fix-worktree | bare repo worktree configuration recovery | [fix-worktree.md](./fix-worktree.md) |\n| githooks | diagnose a `.githooks/` hook that silently never runs (hooksPath precedence, passthrough chains, execute bit) and choose an install method that keeps machine-wide hooks | [githooks.md](./githooks.md) |\n| isolate-hunk | stage only your own edit when a tracked file's working tree mixes it with unrelated uncommitted content, via git plumbing (no working-tree changes) | [isolate-hunk.md](./isolate-hunk.md) |\n| merge-duplicate | merge duplicate repositories with the same origin | [merge-duplicate.md](./merge-duplicate.md) |\n| migrate | **renamed → to-ghq** (backward-compat alias) | [migrate.md](./migrate.md) |\n| move-worktree | move/register unregistered worktrees to .claude/worktrees/, reclaim merged PR worktrees | [move-worktree.md](./move-worktree.md) |\n| patrol | batch inspection of ghq repositories (status, stash, unpushed + commit-splitter integration) | [patrol.md](./patrol.md) |\n| rebase-audit | audit an active interactive rebase's staged files for accidental reverts (HEAD-vs-index diff + revert-pattern heuristic + AskUserQuestion multiSelect) without touching the rebase itself | [rebase-audit.md](./rebase-audit.md) |\n| rename-worktree | rename worktree directory and metadata (cross-platform, Windows safe) | [rename-worktree.md](./rename-worktree.md) |\n| safe-relocate | relocate working commits from a stale, diverged, or dirty branch onto a clean branch cut directly off the latest remote base (5-step procedure) | [safe-relocate.md](./safe-relocate.md) |\n| sourcegit | SourceGit preference.json management (add repos, workspaces, folder rename) | [sourcegit.md](./sourcegit.md) |\n| ssh-key | per-repo SSH key mapping for multi-account GitHub (core.sshCommand + IdentityAgent) | [ssh-key.md](./ssh-key.md) |\n| 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-bare.md) |\n| to-ghq | migrate bare+worktree → regular `.git` at the ghq path (formerly `migrate`) | [to-ghq.md](./to-ghq.md) |\n| worktree | unified worktree acquisition: inventory, reuse inactive, or create new at `.claude/worktrees/` | [worktree.md](./worktree.md) |\n| worktree-drift-sync | re-verify each worktree's git state immediately before/after applying an identical fix across a repo's multiple worktrees under external concurrent editing | [worktree-drift-sync.md](./worktree-drift-sync.md) |\n| worktree-register | shared: register a populated directory as a worktree via metadata only (used by fix-worktree + to-bare) | [worktree-register.md](./worktree-register.md) |\n\n## Topic Dependencies\n\n```\nworktree (entry point — inventory + decision)\n  └─→ rename-worktree (reuse registered worktree)\n  └─→ move-worktree (register unregistered or relocate)\n\nworktree-register (shared metadata register/relink mechanism)\n  ├─← fix-worktree (recover a broken bare-worktree link)\n  └─← to-bare (link the working tree after a regular→bare conversion)\n\nto-bare  ←inverse→  to-ghq (formerly `migrate`)\n\nssh-key (SSH multi-account)  ──counterpart──  credential-helper (HTTPS multi-account)\n\nrebase-audit (active-rebase revert detection)  ──restoration mechanism shared with──  isolate-hunk (targeted hunk staging)\n```\n\n## Worktree decision tree (HARD STOP — every time a worktree is needed)\n\n**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.**\n\n### Flow\n\n1. `git -C <repo> worktree list` to enumerate existing worktrees\n2. **Operation-state gate (HARD STOP — before any inactive classification)**: for each candidate worktree `<W>`, check for an in-progress git operation:\n   ```bash\n   gitdir=$(git -C <W> rev-parse --absolute-git-dir)\n   ls \"$gitdir\"/CHERRY_PICK_HEAD \"$gitdir\"/MERGE_HEAD \"$gitdir\"/REBASE_HEAD \"$gitdir\"/BISECT_LOG \"$gitdir\"/rebase-merge \"$gitdir\"/rebase-apply 2>/dev/null\n   git -C <W> status --porcelain | grep -E '^(DD|AU|UD|UA|DU|AA|UU)'   # unmerged index entries\n   ```\n   Any hit = a cherry-pick/merge/rebase/bisect is **mid-flight** (likely the user's active operation) → the worktree is **NOT an inactive candidate**, its dirty files are the operation's payload (never offer discard / `git add` resolution / stash), and reuse is forbidden — report to the user instead. Merge-status heuristics (branch merged + ahead=0) do NOT override this gate. (see failed-attempts.md \"cherry-pick in progress misclassified as abandoned\")\n3. Identify inactive candidates (only among worktrees that passed the gate):\n   - **Merged-PR worktrees** (commit hash equals the base branch's merge commit)\n   - **Squash-merged-PR worktrees** — see the caveat below; the hash test above does **not** find these\n   - **Stale fix/refactor branch worktrees** (confirm with the user)\n\n   **Hash-equality misses every squash merge (HARD STOP)**: a squash merge creates a new single commit on the base with no parent link to the branch, so a worktree whose PR was squashed keeps a HEAD that matches nothing on the base. The test in the first bullet reports it as *not* merged, and its N original commits still read as unmerged work — which both hides a reclaimable worktree and, worse, makes a genuinely stale branch look active. Ask GitHub for the PR state instead of inferring it from hashes:\n\n   ```bash\n   B=$(git -C <worktree> branch --show-current)\n   gh pr list --head \"$B\" --state all --json number,state,mergedAt --jq '.[0]'\n   ```\n\n   | PR state for the worktree's branch | Classification |\n   |------------------------------------|----------------|\n   | `MERGED` (regardless of merge method) | Inactive candidate — reclaimable |\n   | `OPEN` | Active — not a candidate |\n   | `CLOSED` unmerged, or no PR | Stale candidate — confirm with the user before reuse |\n\n   For a `MERGED` squashed branch, reuse means re-pointing the worktree at a fresh branch off the updated base (`rename-worktree`) — do **not** rebase or merge the old branch forward, since its commits duplicate content the base already carries in squashed form.\n\n   **Batch cleanup**: `scripts/prune_merged_worktrees.py` automates this same `gh pr list --head` check (with a git-native `merge-base --is-ancestor` fallback when `gh` is unavailable) across every non-main worktree in a repository at once — use it instead of the manual per-worktree steps above when clearing out several stale worktrees. Defaults to `--dry-run`; pass `--execute` to actually remove eligible worktrees, `-d`/`--delete-branch` to also delete the local branch, `--scan <root>` to sweep multiple repositories.\n4. If an inactive worktree exists → **reuse via the `rename-worktree` topic** (rename the directory + metadata, switch branch)\n5. If no inactive worktree exists or the user opts for new → `git worktree add`\n\n### New-commit-start trigger (HARD STOP — paired with git.md)\n\n**When committing new work on a main/master/develop branch, if `git status` shows uncommitted changes from another task, worktree splitting is mandatory.**\n\n#### Entry conditions (any one)\n\n- Current branch = main/master/develop\n- `git status` shows 1+ changed files outside the new work (e.g., another task's unstaged files)\n- Unpushed commits include another task's work\n\n#### Decision tree on entry\n\n```\ngit status (check for other changes)\n  ├─ 0 other changes, branch = PR/feature → commit in place\n  ├─ 0 other changes, branch = main/master/develop\n  │    → AskUserQuestion: (a) create PR branch from current (b) create PR branch in a new worktree\n  ├─ 1+ other changes, branch = main/master/develop\n  │    → worktree split required. Leave other changes in place, isolate new work in a new worktree\n  └─ Another task running on a PR branch with stray changes on main\n       → Report to the user (confirm intent of stray changes) → decide worktree split + stray cleanup\n```\n\n#### Worktree split procedure\n\n1. Leave the new work's diff in place — do NOT stash (preserve the working directory)\n2. `git -C <repo> worktree list` to inspect inactive worktrees (per the decision tree above)\n3. Inactive candidate present → reuse via `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\")\n4. cd into the new worktree, then `git checkout -b <new-branch>` (or use the existing inactive branch)\n5. **Re-apply the same diff in the new worktree via Edit** (the original main changes stay on main)\n6. add → commit → push → PR inside the new worktree\n\n#### Don't / Do\n\n| # | Don't | Do |\n|---|-------|-----|\n| 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 |\n| 2 | Hide other changes with `git stash` and commit on main | stash breaks the other task's intent/sequence. Worktree split is safer |\n| 3 | Assume \"my changes only — no conflict\" | Other working-directory changes can spill over (tests, builds, IDE state) |\n| 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 |\n\n### Don't / Do\n\n| # | Don't | Do |\n|---|-------|-----|\n| 1 | Default to `git worktree add <path> <branch>` whenever a worktree is needed | `git worktree list` first → check inactive candidates → consider `rename-worktree` |\n| 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 |\n| 3 | AskUserQuestion options offer only \"create new worktree\" | Include \"reuse an existing worktree by rename\" whenever an inactive worktree exists |\n| 4 | Decide on the worktree autonomously before asking the user | When inactive candidates exist, ask which one to reuse |\n| 5 | Ignore merged-PR worktrees | Reclaim them with move-worktree or rename-worktree |\n| 6 | **Place \"create new worktree\" as option 1/Recommended when inactive candidates exist** | **Reuse is Recommended/option 1.** New is option 2 or below |\n| 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 |\n\n### Recommended placement rule (HARD STOP — prevent 2nd recurrence)\n\n**When building AskUserQuestion options for worktree selection**:\n\n| Inactive candidates | Option order + Recommended |\n|--------------|------------------------|\n| 0 | Option 1: New worktree (Recommended). Option 2: Hold |\n| 1 | **Option 1: Reuse inactive by rename (Recommended)**. Option 2: New worktree. Option 3: Hold |\n| 2+ | **Option 1: Rename inactive A (Recommended)**. Option 2: Rename inactive B. Option 3: New worktree. Option 4: Hold |\n\n**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.\n\n### Self-check (before any worktree work)\n\n1. Did you call `git -C <repo> worktree list`?\n2. **Did you run the operation-state gate (Flow step 2) on every candidate?** A worktree with `CHERRY_PICK_HEAD`/`MERGE_HEAD`/`REBASE_HEAD` or unmerged status codes (DU/UU/AA…) is mid-operation → excluded from candidates, no discard/stash options for its files\n3. Does any gated worktree match (a) the same commit as HEAD or (b) a merge commit hash? → inactive candidate\n4. If inactive candidates exist, include both the new-add option and the reuse option in AskUserQuestion\n5. **Is the Recommended marker attached to the reuse option?** (apply the \"Recommended placement rule\" table)\n6. Use new-add only when 0 inactive candidates exist OR the user explicitly chose new\n\n### Typical failure mode\n\nWhen 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.\n\n## Quick Reference\n\n### ghq Clone (automatic SourceGit registration)\n\nWhen `ghq get <url>` is executed, the following happens automatically:\n1. Clone the repository\n2. Register in SourceGit (under the appropriate group)\n3. Auto-create the group if it doesn't exist\n\n**Proceeds automatically without user confirmation**\n\n[Detailed guide](./clone.md)\n\n### SourceGit Management\n\nDirectly edit the SourceGit GUI client's configuration file to add repositories, create workspaces, rename folders, etc.\n\nKey features:\n- Add/remove repositories\n- Create workspaces\n- Sync ghq repositories\n- Update paths on folder rename\n\n[Detailed guide](./sourcegit.md)\n\n### ghq Migration (to-ghq) / Bare conversion (to-bare)\n\n- **to-ghq** (formerly `migrate`): bare+worktree → regular `.git` at the ghq path (`~/ghq/host/group/repo/`). Auto bare+worktree conversion, optional symlink, nested groups. [Detailed guide](./to-ghq.md)\n- **to-bare** (inverse): regular repo → bare + worktree at a custom location (e.g. `.claude/worktrees/`), preserving uncommitted changes. Includes a Windows lock pre-check (SourceGit/VS Code handle on `.git` blocks the rename). [Detailed guide](./to-bare.md)\n\n### Repo Patrol (batch inspection)\n\nBatch inspect and clean up the status of repositories under ghq.\n\nKey features:\n- Parallel collection of status, stash, unpushed for all repositories\n- Status-based processing (commit-splitter integration, stash pop, push)\n- Optional fetch all at the end\n\n[Detailed guide](./patrol.md)\n\n## Common Workflow\n\n1. **Repository migration**: Migrate to ghq structure with `to-ghq` topic (or `to-bare` for the inverse)\n2. **SourceGit update**: Register new paths with `sourcegit` topic\n3. **Batch inspection**: Clean up uncommitted/unpushed changes with `patrol` topic\n4. **Baseline .gitignore hygiene**: Ensure standard ignore rules (`.worktrees/`, `.DS_Store`, `__pycache__/`, `*.bak`, `*.tmp`) in `.gitignore` or `.git/info/exclude` to isolate worktrees and suppress runtime/editor clutter\n\n## Scripts\n\n- `./scripts/repo-to-ghq.sh` - Move a repository to the ghq path (bare+worktree → regular)\n- `./scripts/repo-to-bare-worktree.sh` - Convert a regular repo → bare + worktree (inverse)\n- `skills/git-repo/scripts/local-to-staging-pr.sh` - Cherry-pick local commit to a staging branch; prints manual push/PR commands by default, or pass `--push [--body-file <path>]` to also push and open the draft PR.\n- `skills/git-repo/scripts/prune_merged_worktrees.py` - Detect and safely remove clean worktrees whose branches are already merged (GitHub PR lookup + git-native ancestry fallback); defaults to `--dry-run`. See the \"Worktree decision tree\" squash-merge caveat above.\n\nFile v0.13.0:README.md\n\n# git-repo\n\nGit repository and worktree management with SourceGit integration — clone via ghq, inventory/reuse/create worktrees, convert repos to bare, and handle multi-account SSH and credentials.\n\n## Installation\n\n```bash\nnpx skills add es6kr/skills --skill git-repo\n```\n\nBrowse on ClawHub: <https://clawhub.ai/skills/git-repo>\n\n### Peer skills\n\n`git-repo` depends on `commit-tidy`. Install it too:\n\n```bash\nnpx skills add es6kr/skills --skill commit-tidy\n```\n\n## Usage\n\nInvoke with `/git-repo <topic>` (for example `/git-repo worktree`). See [`SKILL.md`](./SKILL.md) for the full topic list.\n\nFile v0.13.0:_meta.json\n\n{\n  \"ownerId\": \"kn74k8yfvftx6f062qa8fzyd8h8373jd\",\n  \"slug\": \"git-repo\",\n  \"version\": \"0.13.0\",\n  \"publishedAt\": 1791543251385\n}\n\nFile v0.13.0:CHANGELOG.md\n\n# Changelog\n\n## [0.13.0](https://github.com/es6kr/skills/compare/git-repo-v0.12.1...git-repo-v0.13.0) (2026-10-06)\n\n\n### Features\n\n* **hook-kit:** declarative step-dependency enforcement engine ([9e3d188](https://github.com/es6kr/skills/commit/9e3d18898453d20a947b74b24032e61bf13bc297))\n\n## [0.12.1](https://github.com/es6kr/skills/compare/git-repo-v0.12.0...git-repo-v0.12.1) (2026-10-04)\n\n\n### Bug Fixes\n\n* **git-repo:** add COND-HOOK-REG check for hooks.json integrity in doctor ([#590](https://github.com/es6kr/skills/issues/590)) ([f79bd24](https://github.com/es6kr/skills/commit/f79bd24bc783f488fcab834137efbbf485e579df))\n* **git-repo:** document bash-guard-safe resolution for proven-redundant rebase picks ([a085426](https://github.com/es6kr/skills/commit/a08542616db356db9d4dba63cef72d420d4c40c0))\n* **git-repo:** document upstream-tracking gotcha when branching off a remote-tracking ref ([#583](https://github.com/es6kr/skills/issues/583)) ([04004f9](https://github.com/es6kr/skills/commit/04004f9c506f8b99598b8ea25deb0e928ab632c4))\n* **git-repo:** register safe-relocate in the Topics table ([#591](https://github.com/es6kr/skills/issues/591)) ([6eddf07](https://github.com/es6kr/skills/commit/6eddf079e242fcdae4a3dd94de01410ffb6cbf82))\n\n## [0.12.0](https://github.com/es6kr/skills/compare/git-repo-v0.11.1...git-repo-v0.12.0) (2026-09-24)\n\n\n### Features\n\n* **fix-plan:** add pipeline log and hook integrity check scripts ([e93a432](https://github.com/es6kr/skills/commit/e93a4323b54a311fcda6855163ffe14c2c146412))\n* **git-repo:** add prune_merged_worktrees.py script and guide ([37e6f16](https://github.com/es6kr/skills/commit/37e6f16474701606c4819c28ce480117dbc3b940))\n\n\n### Bug Fixes\n\n* **git-repo:** add prune_merged_worktrees.py + 7 accumulated fixes ([3d2ee94](https://github.com/es6kr/skills/commit/3d2ee9425285347d8f7e7698049d6e5769f73f92))\n* **git-repo:** document prune_merged_worktrees.py in the worktree decision tree and Scripts list ([bb979ca](https://github.com/es6kr/skills/commit/bb979ca3dcd1e4c03aa39e594134bff6d4163eba))\n* **git-repo:** refine repo scan logic to accurately detect root git repositories ([f970a45](https://github.com/es6kr/skills/commit/f970a45f9c9cc3464473052de3ee69a51235369b))\n* **git-repo:** require exact HEAD SHA match before pruning a GitHub-merged worktree ([3d9b7fa](https://github.com/es6kr/skills/commit/3d9b7fae427f484640e05a837394a8eb3f9f3736))\n\n## [0.11.1](https://github.com/es6kr/skills/compare/git-repo-v0.11.0...git-repo-v0.11.1) (2026-09-18)\n\n\n### Bug Fixes\n\n* **cleanup:** make the session-end report table self-sufficient ([#487](https://github.com/es6kr/skills/issues/487)) ([c4a0255](https://github.com/es6kr/skills/commit/c4a02557fb8de3b32cf337c549f62535dabf824b))\n* **git-repo:** stop SIGPIPE from silently disabling every Tier 2 doctor check ([#484](https://github.com/es6kr/skills/issues/484)) ([ab5a64d](https://github.com/es6kr/skills/commit/ab5a64d6c25cf7ab560c4e9b47c860bac94d7fc2))\n\n## [0.11.0](https://github.com/es6kr/skills/compare/git-repo-v0.10.1...git-repo-v0.11.0) (2026-09-06)\n\n\n### Features\n\n* **works-config:** implement v0.2.0 role-based resolution & neutral SSOT guards config ([9dff5c3](https://github.com/es6kr/skills/commit/9dff5c337812dcb23ebb45f7734801f50c9b82c0))\n\n## [0.10.1](https://github.com/es6kr/skills/compare/git-repo-v0.10.0...git-repo-v0.10.1) (2026-09-01)\n\n\n### Bug Fixes\n\n* **git-repo:** add BASE-7 conflict marker guard to doctor topic ([79fe2b5](https://github.com/es6kr/skills/commit/79fe2b5d795cff905f9199f308347b3273bbd82c))\n* **git-repo:** document clobbered-branch-pointer recovery in rebase-audit ([#396](https://github.com/es6kr/skills/issues/396)) ([69b346f](https://github.com/es6kr/skills/commit/69b346fd382c8c3c4f25c9b407358b579fea304e))\n* **git-repo:** document COND-MD-STYLE in the doctor topic ([190b9c1](https://github.com/es6kr/skills/commit/190b9c1a3f7abb842ab443a5e9d261a99f7db71f))\n* staging branch next-fix sync into main ([bbbd460](https://github.com/es6kr/skills/commit/bbbd460bf3b6b1cba4c6d07b3641afa734c89860))\n\n## [0.10.0](https://github.com/es6kr/skills/compare/git-repo-v0.9.1...git-repo-v0.10.0) (2026-08-29)\n\n\n### Features\n\n* **git-repo:** add push commit count limit guard (BASE-6) to doctor and pre-push hook ([#383](https://github.com/es6kr/skills/issues/383)) ([3dde967](https://github.com/es6kr/skills/commit/3dde96749923f2c59788981b3133e7b922c0677d))\n* promote next-feat batch (backlog skill, hooks JS port, git-repo doctor, pre-push guard) ([0d76a4c](https://github.com/es6kr/skills/commit/0d76a4c01180fbdc78bfeec8dea91373b4912470))\n\n\n### Bug Fixes\n\n* address CodeRabbit and Copilot review feedback on PR [#385](https://github.com/es6kr/skills/issues/385) ([e94de34](https://github.com/es6kr/skills/commit/e94de34ce5e075c79b7edc5d672813cea94a0acc))\n* **git-repo:** exclude existing remote tracking commits in pre-push commit count limit guard ([2c5a793](https://github.com/es6kr/skills/commit/2c5a79369d43d41d6995668baf83fab7478ff0ea))\n* **git-repo:** refine pre-push base branch detection and update plane test candidate paths ([b09a6c8](https://github.com/es6kr/skills/commit/b09a6c895113eaf698a12c79744261ec4c5c78d8))\n* **hook-kit:** resolve RAG receiver from workspace config instead of mandating --rag ([58e85ec](https://github.com/es6kr/skills/commit/58e85ecbb437557544cd528281aa30b804bd2532))\n\n## [0.9.1](https://github.com/es6kr/skills/compare/git-repo-v0.9.0...git-repo-v0.9.1) (2026-08-26)\n\n\n### Bug Fixes\n\n* accumulate 16 patch-level bug fixes and guard enhancements across skills ([d214e5d](https://github.com/es6kr/skills/commit/d214e5dcc7fac1bc07baf3b6cec62999aea732f0))\n* **git-repo:** add baseline .gitignore hygiene gate for worktrees and runtime artifacts ([32713d9](https://github.com/es6kr/skills/commit/32713d91e0e05936a78ea7df717b8fe87568269b))\n* **git-repo:** gate worktree reuse on dependency-install cost ([387653c](https://github.com/es6kr/skills/commit/387653c69e5a5172c37dc8f77261ae5ebc9013e7))\n* promote next-fix batch (consolidate fabrication guard, session rewind, config-driven PR base) ([7ca0ccb](https://github.com/es6kr/skills/commit/7ca0ccbf13cefafedc33a16a7361756c95f8b8f6))\n\n## [0.9.0](https://github.com/es6kr/skills/compare/git-repo-v0.8.1...git-repo-v0.9.0) (2026-08-20)\n\n\n### Features\n\n* promote next-feat staging (lifecycle guards, triage automation, and workflow safety procedures) ([77d58ac](https://github.com/es6kr/skills/commit/77d58ac3a771a4897043c9eea8b149ea1e8ba2ff))\n\n\n### Bug Fixes\n\n* **git-repo:** document conflict root-cause diagnosis (staleness vs divergence) ([f034168](https://github.com/es6kr/skills/commit/f0341685d6bf07c9d16e9375c93c22fea88b454f))\n* **git-repo:** document conflict root-cause diagnosis (staleness vs divergence) ([3f8e492](https://github.com/es6kr/skills/commit/3f8e4924bd8a656ea3fc1eeb573c9a629fea80cd))\n* promote next-fix batch (hook path repair, topic-dispatch scoping, conflict diagnosis) ([eb7ecb6](https://github.com/es6kr/skills/commit/eb7ecb61dda9701d78f12dc810781dc7cb687caa))\n\n## [0.8.1](https://github.com/es6kr/skills/compare/git-repo-v0.8.0...git-repo-v0.8.1) (2026-08-17)\n\n\n### Bug Fixes\n\n* **git-repo:** add worktree-ancestry divergence pre-check for staging-branch model ([d28bbdb](https://github.com/es6kr/skills/commit/d28bbdb29a76306d143c812bef6363afb5c66fea))\n* **git-repo:** let rename-worktree base a new branch somewhere other than stale HEAD ([98e9201](https://github.com/es6kr/skills/commit/98e92018b94a9b52bb2c585fdabf158c2347379a))\n* promote next-fix staging (30 fixes across 14 skills) ([ee467c0](https://github.com/es6kr/skills/commit/ee467c045d779d7b80d30f160763ec3534a9742b))\n* **wip:** cross-ref PR-URL and TaskCreate subject repo-qualifier rules ([#186](https://github.com/es6kr/skills/issues/186)) ([4982364](https://github.com/es6kr/skills/commit/49823641a7b08123ebd0325273892bee41bc3280))\n\n## [0.8.0](https://github.com/es6kr/skills/compare/git-repo-v0.7.2...git-repo-v0.8.0) (2026-08-16)\n\n\n### Features\n\n* merge next-feat into main ([#313](https://github.com/es6kr/skills/issues/313)) ([2d9308a](https://github.com/es6kr/skills/commit/2d9308ab3e7e0086a88a7f64d3ed4d5c4d36e017))\n\n## [0.7.2](https://github.com/es6kr/skills/compare/git-repo-v0.7.1...git-repo-v0.7.2) (2026-08-09)\n\n\n### Bug Fixes\n\n* **consolidate:** address CodeRabbit/Copilot review findings on PR [#270](https://github.com/es6kr/skills/issues/270) ([3b11a73](https://github.com/es6kr/skills/commit/3b11a730b5ad68803d35a8264eda540e48265d75))\n* **git-repo:** add worktree-reuse path-canonicality pre-check helper ([#267](https://github.com/es6kr/skills/issues/267)) ([020a94e](https://github.com/es6kr/skills/commit/020a94ee989596941c5669995a7f7ba340742313))\n* **git-repo:** preserve tracked mode in stage-isolated-content.sh cacheinfo ([#259](https://github.com/es6kr/skills/issues/259)) ([161f07d](https://github.com/es6kr/skills/commit/161f07d13bd19f17b190800062955d767e83bf04))\n* **git-repo:** validate worktree path canonicality before reuse ([#240](https://github.com/es6kr/skills/issues/240)) ([e44076b](https://github.com/es6kr/skills/commit/e44076bebe2e952bd042f0539b45322984cd3d72))\n* promote accumulated next-fix fixes to main ([95656e9](https://github.com/es6kr/skills/commit/95656e9b551ee0bb77904a0a571d49c53bc01cc9))\n\n## [0.7.1](https://github.com/es6kr/skills/compare/git-repo-v0.7.0...git-repo-v0.7.1) (2026-08-05)\n\n\n### Bug Fixes\n\n* promote next-fix staging (38 fixes across 16 skills) ([94f8c33](https://github.com/es6kr/skills/commit/94f8c33800ce411ae63e22c5259cdae8435508a4))\n\n## [0.7.0](https://github.com/es6kr/skills/compare/git-repo-v0.6.1...git-repo-v0.7.0) (2026-08-03)\n\n\n### Features\n\n* promote next-feat to main ([4fbe313](https://github.com/es6kr/skills/commit/4fbe31332c58bf24327d819cc9204ebda2d4afa8))\n\n\n### Bug Fixes\n\n* **git-repo:** add --push flag to local-to-staging-pr.sh ([#191](https://github.com/es6kr/skills/issues/191)) ([7eec556](https://github.com/es6kr/skills/commit/7eec556a6411352781de33121c42da0e186512b3))\n\n## [0.6.1](https://github.com/es6kr/skills/compare/git-repo-v0.6.0...git-repo-v0.6.1) (2026-07-28)\n\n\n### Bug Fixes\n\n* **git-repo:** add commit-worktree-cherry-pick-draft-PR section + resolve stray merge markers ([4417701](https://github.com/es6kr/skills/commit/44177013a9e7af8a49cff79e1f7c82436410645e))\n* **git-repo:** add commit-worktree-cherry-pick-draft-PR section + resolve stray merge markers ([9f2dc23](https://github.com/es6kr/skills/commit/9f2dc2351874fda79e9ef4fe7608f51a6a5c5d68))\n* **git-repo:** scope conflict-resolution to next-fix, add missing script ([a23f749](https://github.com/es6kr/skills/commit/a23f749bfbf8ad8702f887ed5e85c0bd6fdff860))\n* **next-fix:** promote staged fixes across hook-kit, next, cleanup, fix-plan ([34f1c67](https://github.com/es6kr/skills/commit/34f1c67beee3a8279e0e80de4ab3a87ba2223d5c))\n* resolve PR [#197](https://github.com/es6kr/skills/issues/197) review findings (CodeRabbit + Copilot + Internal Review) ([b54236a](https://github.com/es6kr/skills/commit/b54236a4fa4b3fef23645dfc3b184916980b7f65))\n\n## [0.6.0](https://github.com/es6kr/skills/compare/git-repo-v0.5.0...git-repo-v0.6.0) (2026-07-23)\n\n\n### Features\n\n* **consolidate:** address PR 134 reviews and reflect orange/yellow severity display rules ([e6118d0](https://github.com/es6kr/skills/commit/e6118d0fb0217a4c4ad388b82e574203a8f9258e))\n* **next-feat:** accumulate features for hook-kit context gate ([df4f73a](https://github.com/es6kr/skills/commit/df4f73ae4d27d4919105da70c6c94a14a32e8056))\n* skills topic bundle — brief/email, code-workflow/plan-research-search, git-repo topics, skill-kit/invoke-discipline ([7fd877d](https://github.com/es6kr/skills/commit/7fd877da1b703fcdcdcaf1a3ce912f885abfa3f0))\n\n## [0.5.0](https://github.com/es6kr/skills/compare/git-repo-v0.4.3...git-repo-v0.5.0) (2026-07-19)\n\n\n### Features\n\n* **git-repo,cleanup:** promote next-feat staging ([8ffeb4e](https://github.com/es6kr/skills/commit/8ffeb4e487e68ac034e349bf765fe144eae5d68d))\n* **git-repo:** add local-to-staging-pr.sh for the staging-PR flow ([#105](https://github.com/es6kr/skills/issues/105)) ([166d481](https://github.com/es6kr/skills/commit/166d481836a1812cb8b18cc6ed8d1870fb99cfbc))\n\n\n### Bug Fixes\n\n* **git-repo:** harden worktree checks against ls multi-arg false nega… ([#110](https://github.com/es6kr/skills/issues/110)) ([2c5f1e3](https://github.com/es6kr/skills/commit/2c5f1e3810b9cd67247d26d80e978aa84fd3e07a))\n* **pr111:** resolve 14 consolidated review findings ([38f8833](https://github.com/es6kr/skills/commit/38f88332f03ec3bc5085083ea155f093a536acf2))\n\n## [0.4.3](https://github.com/es6kr/skills/compare/git-repo-v0.4.2...git-repo-v0.4.3) (2026-07-16)\n\n\n### Bug Fixes\n\n* **consolidate,fix-plan:** promote next-fix staging (review hardening + periodic archive) ([24726e9](https://github.com/es6kr/skills/commit/24726e99a5b2972f706d8749ea3a45cbc358984b))\n* **git-repo:** gate worktree reuse on active operation state ([542f236](https://github.com/es6kr/skills/commit/542f2366682214fed869ec3f5776eb5017b114fb))\n\n\n### Documentation\n\n* add install-guide READMEs for consolidate, git-repo, skill-kit ([380db80](https://github.com/es6kr/skills/commit/380db8070a60dbfe1be29d940a6740e1119db748))\n* add install-guide READMEs for consolidate, git-repo, skill-kit ([d9bec4b](https://github.com/es6kr/skills/commit/d9bec4bb17c294a40c373c376a2f22aa0d3c04f2))\n* correct skills install command (add, not install) + superpowers namespace ([ed8fb1a](https://github.com/es6kr/skills/commit/ed8fb1ab2cd251e2395363948104bd3d3915f010))\n\n## [0.4.2](https://github.com/es6kr/skills/compare/git-repo-v0.4.1...git-repo-v0.4.2) (2026-06-25)\n\n\n### Bug Fixes\n\n* **fix:** split Step 2 medium by content type — case history to failed-attempts.md ([#62](https://github.com/es6kr/skills/issues/62)) ([747b3f9](https://github.com/es6kr/skills/commit/747b3f957ca0fefdbc5044eb08f66b8aafc1e26a))\n* **skills:** apply PR [#50](https://github.com/es6kr/skills/issues/50) Phase 2 follow-up reviews ([33863d7](https://github.com/es6kr/skills/commit/33863d705f8b24051b030b839487e8b5a8bfd9df))\n\n## [0.4.1](https://github.com/es6kr/skills/compare/git-repo-v0.4.0...git-repo-v0.4.1) (2026-06-19)\n\n\n### Bug Fixes\n\n* bundle skill patches across 7 scopes ([f18f47c](https://github.com/es6kr/skills/commit/f18f47c2d05f13b8e3f3ad42675a2dabbb31c824))\n* **git-repo:** clarify repo-to-bare-worktree index reset behavior ([1503dbf](https://github.com/es6kr/skills/commit/1503dbf29e9eb4269e892920772ab24024b358e3))\n* **git-repo:** note relative gitdir edge case in rename-worktree.sh ([3761f77](https://github.com/es6kr/skills/commit/3761f7714eb0de26be63bf03d634c4753ff12560))\n* **git-repo:** support bare-with-worktree layout in rename-worktree.sh ([3a2e261](https://github.com/es6kr/skills/commit/3a2e2618f3e85bcbeb500cfd023dccf9241cff7c))\n\n## [0.4.0](https://github.com/es6kr/skills/compare/git-repo-v0.3.2...git-repo-v0.4.0) (2026-06-12)\n\n\n### Features\n\n* decompose workflow/git rules + rename web-ui-test→web-browser ([#50](https://github.com/es6kr/skills/issues/50)) ([e10d48f](https://github.com/es6kr/skills/commit/e10d48fea4e507b95888de44812b53484d32128d))\n\n## [0.3.2](https://github.com/es6kr/skills/compare/git-repo-v0.3.1...git-repo-v0.3.2) (2026-06-07)\n\n\n### Bug Fixes\n\n* **git-repo,skill-kit:** pre-commit worktree matrix + external-system structure check ([7f05819](https://github.com/es6kr/skills/commit/7f058194fcf568b7cac57fd79788b20caf217ae5))\n* **git-repo,skill-kit:** strictyaml description block scalar ([#44](https://github.com/es6kr/skills/issues/44)) ([fe0da66](https://github.com/es6kr/skills/commit/fe0da66e80ee06e2e30190a4afc4c12363f0d51f))\n* **skill-git-repo:** add Pre-commit worktree matrix check section ([98b3f0f](https://github.com/es6kr/skills/commit/98b3f0f37dd2c92022ab8d739aacffbd5846589c))\n* **skill-kit,git-repo:** address PR [#46](https://github.com/es6kr/skills/issues/46) review findings 1-6 ([ba4592c](https://github.com/es6kr/skills/commit/ba4592c9209718bab7ba2af82f060f82a529f1e6))\n\n## [0.3.1](https://github.com/es6kr/skills/compare/git-repo-v0.3.0...git-repo-v0.3.1) (2026-06-03)\n\n\n### Documentation\n\n* **git-repo:** expand ssh-key HTTPS credential helper guidance ([07b189c](https://github.com/es6kr/skills/commit/07b189ce33b0f4c06c4275483bb1fd7041c65084))\n* **git-repo:** qualify Full Disk Access guidance as macOS-specific ([cfcc250](https://github.com/es6kr/skills/commit/cfcc2508092bb5d7609e8fea891572b094d6a916))\n\n## [0.3.0](https://github.com/es6kr/skills/compare/git-repo-v0.2.0...git-repo-v0.3.0) (2026-05-27)\n\n\n### Features\n\n* **git-repo:** add worktree management + multi-account SSH topics ([#26](https://github.com/es6kr/skills/issues/26)) ([3486eba](https://github.com/es6kr/skills/commit/3486eba3e1a670e57a672303b4d89ee20b0a7831))\n\n## [0.2.0](https://github.com/es6kr/skills/compare/git-repo-v0.1.2...git-repo-v0.2.0) (2026-05-24)\n\n\n### Features\n\n* **ci:** add lint jobs and untrack LICENSE ([#7](https://github.com/es6kr/skills/issues/7) Phase 1) ([03a8587](https://github.com/es6kr/skills/commit/03a85872c575c6ffdf72f5ca2bdb353fdc947a73))\n* publish 7 new skills, update 4 existing skills ([dce016d](https://github.com/es6kr/skills/commit/dce016da291f4c9da03746f8be668fa5db04e578))\n\n\n### Bug Fixes\n\n* address CodeRabbit review findings on PR [#4](https://github.com/es6kr/skills/issues/4) ([bbaefdc](https://github.com/es6kr/skills/commit/bbaefdc8a88f26b0b072e115d0696e732ac52e0c))\n\nFile v0.13.0:clone.md\n\n# ghq Clone\n\nWorkflow for automatically registering in SourceGit after `ghq get`.\n\n## When to Use\n\n- User runs `ghq get <url>`\n- User mentions \"ghq clone\", \"ghq get\", \"clone repository\"\n- Skill arguments contain URL (https:// or git@)\n\n## Workflow\n\n### Step 0: Pre-Clone Check (verify existing repository)\n\n**CRITICAL**: Check for existing repository before running ghq get\n\n#### 0-1. Check existing paths\n\nExtract repo name from URL and check related paths:\n\n```bash\n# 1. ghq default repository (ghq checks automatically - skip)\n# ~/ghq/host/group/repo\n\n# 2. Check bare repository (ghq does NOT check this!)\nls ~/ghq/host/group/repo.git 2>/dev/null\n\n# 3. Check existing worktree paths (paths registered in SourceGit)\n# ~/works/group/repo format\n```\n\n#### 0-1a. Handle broken clone remnants\n\nIf a directory with only an empty `.git` remains from a previously failed clone, `ghq get` will skip it as \"exists\":\n\n```bash\n# Detect broken repository\ncd ~/ghq/host/group/repo && git status 2>&1\n# → \"fatal: not a git repository\" → broken state\n\n# Move broken directory and re-clone\nmv ~/ghq/host/group/repo ~/.claude/.bak/repo_$(date +%Y%m%d)\n```\n\n#### 0-2. When bare repository exists\n\nIf a bare repository (`~/ghq/.../repo.git`) is found:\n\n1. **Check status**: Verify connected worktrees and changes\n2. **Convert if needed**: Can convert to regular repository using `migrate` topic\n\n#### 0-3. Check SourceGit registration path\n\nCheck if existing repository is registered in SourceGit:\n\n```bash\n# Search for repo name in preference.json\ngrep -l \"repo-name\" ~/Library/Application\\ Support/SourceGit/preference.json\n```\n\nIf a registered path is found:\n\n1. Check for changes at that path\n2. Check if `.git` is a file (recommend conversion if it's a worktree)\n\n### Step 1: Clone with ghq\n\nAfter pre-check passes:\n\n```bash\nghq get <url>\n```\n\nParse cloned path from output:\n\n- Extract path from `clone https://... -> /path/to/repo` format\n\n### Step 1.5: Repository `.gitignore` Hygiene Baseline Check\n\nVerify that the cloned repository has standard baseline ignores configured (or add to `.git/info/exclude` / `.gitignore`):\n\n- `.worktrees/` (Worktree isolation)\n- `.DS_Store` (OS junk)\n- `__pycache__/` (Python bytecode cache)\n- `*.bak` (Local backup files)\n- `*.tmp` (Temporary files)\n\n```bash\n# Verify baseline ignore patterns\ncd /path/to/repo\ngrep -q \"^\\.worktrees/\" .gitignore 2>/dev/null || echo -e \"\\n# Worktrees & Runtime\\n.worktrees/\\n.DS_Store\\n__pycache__/\\n*.bak\\n*.tmp\" >> .gitignore\n```\n\n### Step 2: Parse Repository Info\n\nExtract host/group/repo from URL:\n\n- `https://github.com/org/repo.git`\n  - Host: `github.com`\n  - Group: `org`\n  - Repo: `repo`\n\n### Step 3: Check SourceGit Status\n\n```bash\npgrep -x SourceGit\n```\n\n- **Running**: **Skip** SourceGit registration and report clone path only. When SourceGit exits, it overwrites preference.json on disk with its in-memory version, so edits made while running will be lost.\n- **Not running**: Proceed with registration\n\n### Step 4: Read preference.json\n\n```bash\ncat ~/Library/Application\\ Support/SourceGit/preference.json\n```\n\n### Step 5: Find or Create Group\n\nFind group in RepositoryNodes:\n\n1. Search by group name (e.g., `org-name`)\n2. If not found, create new group:\n\n```json\n{\n  \"Id\": \"uuid-v4\",\n  \"Name\": \"org-name\",\n  \"Bookmark\": 0,\n  \"IsRepository\": false,\n  \"IsExpanded\": true,\n  \"Status\": null,\n  \"SubNodes\": []\n}\n```\n\n### Step 6: Add Repository to Group\n\nAdd to the group's SubNodes:\n\n```json\n{\n  \"Id\": \"/Users/user/ghq/github.com/org/repo\",\n  \"Name\": \"repo\",\n  \"Bookmark\": 0,\n  \"IsRepository\": true,\n  \"IsExpanded\": false,\n  \"Status\": null,\n  \"SubNodes\": []\n}\n```\n\n### Step 7: Save and Report\n\nEdit preference.json with Edit tool and report result:\n\n```\nClone and SourceGit registration complete:\n- Path: ~/ghq/github.com/org/repo\n- Group: org\n\nWill be reflected when SourceGit is restarted.\n```\n\n## Group Naming Strategy\n\n| URL Host    | Group Name                          |\n| ----------- | ----------------------------------- |\n| github.com  | github.com > org hierarchy          |\n| Other       | host > group hierarchy              |\n\n## GitHub Multi-Account Clone\n\nWhen `gh auth switch` bug prevents active account switching, specify `GH_TOKEN` directly for cloning:\n\n```bash\n# 1. Clone with target account's token\nTOKEN=$(gh auth token --user <GITHUB_USER> 2>/dev/null)\ngit clone \"https://<GITHUB_USER>:${TOKEN}@github.com/org/repo.git\" ~/ghq/github.com/org/repo\n\n# 2. Always remove token from origin after cloning\ngit -C ~/ghq/github.com/org/repo remote set-url origin \"https://github.com/org/repo.git\"\n```\n\n**gh auth switch bug detection**:\n```bash\ngh auth switch --user <GITHUB_USER> 2>&1  # \"Switched\" message output\ngh api user --jq '.login'                  # still shows other user → bug\n```\n\nIn this case, `ghq get` uses the default account token and fails. Use `git clone` + direct `GH_TOKEN` instead.\n\n## No Questions Asked\n\n**Important**: This workflow proceeds automatically without user confirmation.\n\n- ghq get succeeds → SourceGit registration (only when SourceGit is not running)\n- Group doesn't exist → auto-create\n- **SourceGit is running → skip registration** (in-memory content overwrites disk on exit)\n\nFile v0.13.0:conflict-dry-run.md\n\n# Conflict Dry-Run\n\nTest whether a merge or cherry-pick would apply cleanly, without touching the (possibly dirty) main working tree.\n\n## When to Use\n\n- Verifying a commit will cherry-pick cleanly onto another branch before actually doing it\n- Checking whether two branches (e.g. a staging branch and `main`) would conflict before opening a promotion PR\n- Any dry-run test where the main working tree has uncommitted changes you must not disturb\n\n## Why Not the Main Working Tree\n\nRunning `git checkout -b <tmp> <ref>` or `git merge --no-commit` directly in the main working tree risks:\n\n- Colliding with uncommitted changes already present (the dry-run's changed files may overlap with real in-progress edits)\n- Leaving the repo in a half-merged/half-checked-out state if the test is interrupted\n- Requiring careful cleanup (`git merge --abort`, checkout back) that itself competes with concurrent work in the same tree\n\nAn isolated worktree sidesteps all of this — it has its own working tree and index, entirely separate from the main one.\n\n## Procedure\n\n### 1. Create a detached worktree from the bare mirror\n\nUse the bare mirror (`ghq`-style bare clone), not the main working tree, as the source:\n\n```bash\nBARE=/path/to/ghq/github.com/<org>/<repo>.git   # or any bare/mirror remote of the repo\nSCRATCH=/tmp/conflict-check                      # any scratch location, session-specific\n\ngit -C \"$BARE\" worktree add --detach \"$SCRATCH\" origin/<base-ref>\n```\n\n`--detach` avoids the \"branch already checked out elsewhere\" error when the branch under test is also checked out in another active worktree.\n\n### 2. Run the test\n\n**Cherry-pick applicability**:\n\n```bash\ncd \"$SCRATCH\"\ngit cherry-pick --no-commit <sha>\ngit status --short          # staged M/A with no U (unmerged) = clean\ngit diff --stat              # confirm expected file set\n```\n\n**Merge cleanliness** (e.g. would branch A merge cleanly into branch B):\n\n```bash\ncd \"$SCRATCH\"\ngit merge origin/<other-branch> --no-commit --no-ff\ngit diff --name-only --diff-filter=U | wc -l   # 0 = clean, N>0 = N conflicting files\n```\n\n### 3. Clean up\n\n```bash\ncd \"$SCRATCH\"\ngit merge --abort 2>/dev/null || git reset --hard   # discard the dry-run state\ncd \"$BARE\"\ngit worktree remove --force \"$SCRATCH\"\n```\n\nIf a safety hook blocks `git merge --abort` (treating it as \"discarding in-progress conflict resolution\"), it is safe to leave the disposable scratch worktree as-is rather than force through the guard — it does not affect the main working tree or any shared branch.\n\n## Don't / Do\n\n| # | Don't | Do |\n|---|-------|-----|\n| 1 | `git checkout -b <tmp>` in the main working tree to test a merge/cherry-pick | `git worktree add --detach <bare> <ref>` — isolated, no risk to uncommitted work |\n| 2 | Trust `git merge-tree <base> <a> <b>` (legacy 2-tree form) with the wrong base argument (e.g. passing one of the branches itself as base) | Compute the actual merge-base first (`git merge-base <a> <b>`) and pass that, or just do a real `git merge --no-commit` in an isolated worktree — it's authoritative where `merge-tree` misuse is not |\n| 3 | Interpret a platform's `mergeable: false` / `mergeable_state: \"dirty\"` API field as possibly stale without checking | Reproduce locally via this dry-run procedure before concluding the platform's mergeability computation is wrong |\n| 4 | Leave the scratch worktree registered after the test | Remove it (`git worktree remove --force`) unless a safety hook blocks the abort step — in that case leaving it is harmless (see Step 3) |\n| 5 | With `git merge-tree --write-tree <branch1> <branch2>` (no explicit base), read the printed unmerged stages by intuition | Stage numbers are fixed regardless of which side \"looks like\" base: **1 = merge-base, 2 = branch1 (ours), 3 = branch2 (theirs)**. Mislabeling these inverts which side's content you think is which — verify by diffing each stage's blob against the actual ref tips, don't assume from context |\n\n## Diagnosing why a conflict exists (base staleness vs. genuine divergence)\n\nA conflict against an accumulation branch has two structurally different causes that call for different fixes:\n\n- **Base staleness**: the target base is behind another branch it should track — switching base or rebasing resolves it trivially\n- **Genuine parallel divergence**: an equivalent fix already landed on the target via a different commit, so the conflicting commit's content is now partially or fully redundant — switching base changes nothing (the same conflict reproduces against any branch containing that equivalent fix)\n\nBefore assuming staleness, check whether the conflict is redundant, not just stale:\n\n```bash\n# Does the target already contain equivalent content for the touched files?\ngit diff origin/<candidate-base-A> origin/<candidate-base-B> -- <touched-paths>   # empty = both bases identical here, switching base won't help\n\n# Is the conflicting commit's content already upstream (a \"straggler\")?\ngit cherry -v origin/<base> <branch>   # '-' prefix = already upstream (delta 0), '+' = real delta\n```\n\n`git cherry -v` showing `+` (real delta) does not rule out redundancy at the *file* level — a commit can carry one hunk that's genuinely new and another that's fully superseded by a separate, already-merged commit. When that's the case, resolving via `git rebase <target>` and taking the target's version for the superseded hunk often makes the redundant sub-commit collapse to empty (git drops it automatically) while the genuinely new content survives untouched — a cleaner outcome than manually splicing the two versions.\n\n## Related\n\n- [worktree.md](./worktree.md) — general worktree inventory/reuse/create workflow (for actual work, not dry-run testing)\n\nFile v0.13.0:credential-helper.md\n\n# Credential Helper (HTTPS multi-account)\n\nPin a per-org GitHub token for HTTPS remotes so the **active `gh` account** never decides which credential a private-org repo gets. The HTTPS counterpart to the SSH-focused `ssh-key` topic.\n\n## When to Use\n\n- Multiple GitHub accounts authenticated in `gh` (`gh auth status` shows 2+ accounts)\n- A private org repo intermittently fails with `remote: Repository not found` over **HTTPS** — typically right after working on a different org whose account became active\n- The failure \"fixes itself\" when you switch `gh` accounts, then returns later\n- SourceGit / other GUI clients hit the same `Repository not found` because they call git's HTTPS credential pipeline directly\n\nIf the remote is SSH (`git@github.com:...`), use the `ssh-key` topic instead.\n\n## Root Cause\n\nWhen the global gitconfig routes GitHub HTTPS auth through `gh`:\n\n```\n[credential \"https://github.com\"]\n    helper = !gh auth git-credential\n```\n\n`gh auth git-credential` returns the token of the **currently active** `gh` account. If the active account lacks access to a private repo, GitHub returns `404` for the repo, which git surfaces as:\n\n```\nremote: Repository not found.\nfatal: repository 'https://github.com/<org>/<repo>.git/' not found\n```\n\nThe repo exists and the *correct* account has access — but the *active* account doesn't, so it reads as \"not found\" (GitHub returns 404, not 403, for private repos you can't see). Because the active account flips as you move between orgs, the breakage is recurring rather than permanent.\n\n| # | Don't | Do |\n|---|-------|-----|\n| 1 | Read `Repository not found` as \"the repo was deleted/renamed\" | Verify existence + access with the right account first (`gh repo view <org>/<repo> --json isPrivate`) before assuming the repo is gone |\n| 2 | Fix it by `gh auth switch` each time | Switching is temporary — it breaks again when the active account flips. Pin the account per-org (Solution below) |\n| 3 | Assume the credential helper is `manager`/GCM because `git config credential.helper` says so | A path-specific `credential.https://github.com.helper` overrides the generic helper. Check `git config --global --get-regexp 'credential.*github'` for the helper that actually runs |\n\n## Diagnosis\n\n```bash\nREPO=<path-to-repo>\n\n# 1. Which gh accounts exist, and which is active?\ngh auth status\n\n# 2. Reproduce the failure on the actual auth path (no interactive prompt)\nGIT_TERMINAL_PROMPT=0 git -C \"$REPO\" ls-remote origin -h 2>&1 | head -3\n#    → \"remote: Repository not found.\" confirms the active-account mismatch\n\n# 3. Confirm the repo exists + which account has access\ngh auth switch --user <account-with-access>\ngh repo view <org>/<repo> --json name,isPrivate     # succeeds → access OK\nGIT_TERMINAL_PROMPT=0 git -C \"$REPO\" ls-remote origin -h ; echo \"exit=$?\"   # exit=0 → access OK\n\n# 4. Inspect the helper that actually runs for github.com\ngit config --global --get-regexp 'credential.*github'\n```\n\nIf step 2 fails with the active account but step 3 succeeds after switching, the diagnosis is confirmed: **HTTPS auth is bound to the active account**.\n\n## Solution — org-scoped credential helper\n\nAdd a credential helper **scoped to the org path** that always emits the correct account's token, independent of the active `gh` account:\n\n```bash\n# Back up first (gitconfig is a user file)\ncp ~/.gitconfig ~/.gitconfig.bak\n\n# Empty value resets inherited helpers for this path, then add the pinned one\ngit config --global credential.https://github.com/<org>.helper \"\"\ngit config --global --add credential.https://github.com/<org>.helper \\\n  '!f() { echo username=<account>; echo \"password=$(gh auth token --user <account>)\"; }; f'\n```\n\nResulting config block:\n\n```\n[credential \"https://github.com/<org>\"]\n    helper =\n    helper = !f() { echo username=<account>; echo \"password=$(gh auth token --user <account>)\"; }; f\n```\n\nHow it works:\n\n- `credential.https://github.com/<org>` matches only URLs under that org → other orgs are untouched\n- The empty `helper =` **resets** the helper list accumulated from the broader `https://github.com` scope, so the generic active-account helper is not also consulted for this org\n- `gh auth token --user <account>` returns that specific account's token regardless of which account is active\n- Works for git CLI **and** GUI clients (SourceGit etc.), since they all call git's HTTPS credential pipeline\n\n| # | Don't | Do |\n|---|-------|-----|\n| 1 | Set it per-repo (`git config` without `--global`) and re-do it on every clone | Scope to the org path in global config — every current and future repo under `<org>` inherits it |\n| 2 | Omit the empty `helper =` reset | Without the reset, both the pinned helper and the generic active-account helper run; the active-account one can still win and re-break auth |\n| 3 | Hardcode the token into the helper | Use `gh auth token --user <account>` so the token rotates with `gh` and is never written to disk |\n| 4 | Edit `~/.gitconfig` blind | `cp ~/.gitconfig ~/.gitconfig.bak` first — it is a user-owned file |\n\n## Verification (HARD STOP — GUI client too)\n\nCLI passing alone is insufficient. The recurring failure was originally reported in a GUI client, so verify there.\n\n```bash\n# CLI: with the WRONG account still active, the org repo must now succeed\ngh auth switch --user <other-account>          # simulate the breaking condition\nGIT_TERMINAL_PROMPT=0 git -C \"$REPO\" ls-remote origin -h ; echo \"exit=$?\"   # expect exit=0\n\n# Regression: a repo under a DIFFERENT org must still use its own account\nGIT_TERMINAL_PROMPT=0 git -C <other-org-repo> ls-remote origin -h >/dev/null 2>&1 && echo \"no regression\"\n```\n\n| Verification | Action |\n|--------------|--------|\n| CLI (active = wrong account) | `git ls-remote origin` from the repo → exit 0, no `Repository not found` |\n| Other-org regression | `git ls-remote` on a repo under a different org → still succeeds with its own account |\n| **SourceGit** | Open the repo → **Fetch** → must succeed without `Repository not found` |\n| Other GUI (GitHub Desktop, etc.) | Fetch origin → confirm success |\n\n**Do not declare \"fix complete\" until the user's GUI client (the one that reported the failure) succeeds.** CLI green + GUI red = same root issue still active.\n\n## Notes\n\n- Global org-scoped config covers all repos under `<org>` — no per-clone re-application (unlike per-repo SSH `core.sshCommand`)\n- This is HTTPS-only. For SSH remotes with the same multi-account problem, see the `ssh-key` topic\n- The org → account mapping is the user's to decide; this topic only pins whatever mapping is given\n- `gh auth token --user <account>` requires that account to be logged in (`gh auth login`) at least once\n\nFile v0.13.0:doctor.md\n\n# Git Repository & Hook Doctor\n\nComprehensive health check and diagnosis for Git repository hooks across universal (Tier 1 Base) and context-specific (Tier 2 Conditional) standards.\n\n## When to Use\n\n- Repository pre-push or pre-commit checks fail unexpectedly or are bypassed\n- New repository onboarding or repository hooks audit (`.githooks` vs `core.hooksPath`)\n- Branch deletion wastes heavy CI resources in `pre-push`\n- Staging and pushing private branches (e.g. `refs/heads/local`) needs protection\n- Audit public repositories for secret/Korean text leakage or corporate repositories for direct `main` push protection\n- A merge commit's message still shows a leftover `# Conflicts:` block (produced by `git merge --no-edit` or another non-interactive commit path after resolving conflicts)\n- User mentions: \"repo doctor\", \"hook health\", \"diagnose hooks\", \"check hooks\", \"hook wiring\", \"zero-SHA pre-push\", \"doctor\", \"Conflicts:\", \"conflict marker in commit message\"\n\n---\n\n## 2-Tier Diagnostic Taxonomy\n\n```mermaid\ngraph TD\n    A[git-repo doctor] --> B[Tier 1: Base Universal Checks]\n    A --> C[Tier 2: Conditional Checks]\n    \n    B --> B1[BASE-1: Hook Wiring]\n    B --> B2[BASE-2: File Permissions]\n    B --> B3[BASE-3: Zero-SHA Pre-push Exit]\n    B --> B4[BASE-4: Local Branch Guard]\n    B --> B5[BASE-5: Secret & IP Guard]\n    B --> B6[BASE-6: Push Commit Limit Guard]\n    B --> B7[BASE-7: Conflict Marker Guard]\n    \n    C --> C1[COND-MD: Markdown Lint]\n    C --> C1S[COND-MD-STYLE: Markdown Style Lint]\n    C --> C2[COND-SKILL: Skill Frontmatter]\n    C --> C3[COND-AGENT: Tracker Guard]\n    C --> C4[COND-GO: Go Toolchain Lint]\n    C --> C5[COND-PUBLIC: English Hangul Gate]\n    C --> C6[COND-CORP: Main Branch Push Block]\n    C --> C7[COND-HOOK-REG: Hook Registration Integrity]\n```\n\n### Tier 1: Base (Universal) Checks\n\n| ID | Category | Target | Rule & Failure Condition |\n| :--- | :--- | :--- | :--- |\n| **`BASE-1`** | **Hook Wiring** | `.githooks` vs `core.hooksPath` | If `.githooks/` directory exists, `core.hooksPath` MUST point to `.githooks`. Otherwise Git reads default `.git/hooks` and `.githooks/` is completely unwired/ignored. |\n| **`BASE-2`** | **Permissions** | Executable bit (`+x`) | Active hook files (`pre-commit`, `pre-push`, `commit-msg`, etc.) must have executable bits (`chmod +x`). |\n| **`BASE-3`** | **Pre-push Deletion** | Zero-SHA early exit | `pre-push` hook must detect remote branch deletion (`local_sha=0000...0000`, `local_ref=(delete)`, or `remote_sha=0000...0000`) and skip heavy CI tests immediately. |\n| **`BASE-4`** | **Local Branch Guard** | `local` / private branch guard | `pre-push` hook must contain a guard blocking accidental push of private staging branches (`refs/heads/local*`, `wip*`, `scratch*`) to remote. |\n| **`BASE-5`** | **Secret & IP Guard** | Secret / IP scan | `pre-commit` hook must scan staged files for private RFC1918 IPs (`10.x`, `192.168.x`, `172.16-31.x`) and home paths. |\n| **`BASE-6`** | **Push Commit Limit Guard** | Outgoing commit count check | `pre-push` hook must check outgoing commit count (`rev-list --count` / `PUSH_MAX_COMMITS`) and block pushes exceeding the limit (default: 5) to prevent publishing massively diverged commits caused by wrong base branch selection. Override via `PUSH_COMMIT_LIMIT_OVERRIDE=1`. |\n| **`BASE-7`** | **Conflict Marker Guard** | Outgoing commit message scan | `pre-push` hook must scan each outgoing commit's message for a literal `Conflicts:` section (the auto-generated merge-conflict listing that `git merge --no-edit`, or any non-interactive commit path, leaves un-stripped) and block the push. Override via `PUSH_CONFLICT_MSG_OVERRIDE=1`. |\n\n### Tier 2: Conditional Checks\n\n| ID | Trigger Condition | Category | Requirement |\n| :--- | :--- | :--- | :--- |\n| **`COND-MD`** | Repository contains `*.md` | **Markdown Lint** | `pre-commit` or `pre-push` must contain markdown/hangul or link reference validator. |\n| **`COND-MD-STYLE`** | Repository contains `*.md` | **Markdown Style Lint** | A markdown style/whitespace linter (`markdownlint`, `remark-lint`, `mdl`, or `prettier --check` on `*.md`) declared in a `Makefile`, `package.json`, or `scripts/` must be invoked from `pre-commit`, `pre-push`, or CI. Distinct from `COND-MD`: frontmatter and hangul checks do not catch trailing whitespace or style drift, so a repository can pass `COND-MD` while having no style lint at all. WARN when no tooling manifest is present, or when a manifest exists but declares no style linter; FAIL when a linter is declared but never invoked. |\n| **`COND-SKILL`** | Repository contains `skills/*/SKILL.md` | **Skill Frontmatter** | `pre-push` or `pre-commit` must run `lint-frontmatter.sh` or equivalent metadata validator. |\n| **`COND-AGENT`** | Workspace is `.agents/` or has `fix_plan.md` | **Tracker Guard** | `pre-commit` must protect against committing untracked/dirty `fix_plan.md`. |\n| **`COND-GO`** | `go.mod` is present | **Go Toolchain** | `pre-commit`/`pre-push` must run `gofmt` / `go vet` / `go test`. |\n| **`COND-PUBLIC`** | Remote is public (`es6kr/*`) | **Public English Gate** | `pre-commit` must contain `check-hangul` gate to enforce English-only text. |\n| **`COND-CORP`** | Remote is corporate (`internal-org/*`) | **Corp Main Block** | `pre-push` must block direct push to `main` / `master` branches. |\n| **`COND-HOOK-REG`** | Repository contains `hooks/hooks.json` | **Hook Registration Integrity** | A hook registration verifier such as `scripts/verify-hooks-json.py` must run in both pre-commit and CI, catching duplicate registrations, ghost paths, and non-executable registered scripts. |\n\n---\n\n## CLI Usage\n\n### Basic Execution\n\n```bash\n# Run doctor on current repository\nbash skills/git-repo/scripts/git-repo-doctor.sh\n\n# Run doctor on a specific repository path\nbash skills/git-repo/scripts/git-repo-doctor.sh /path/to/repo\n\n# Output machine-readable JSON format\nbash skills/git-repo/scripts/git-repo-doctor.sh . --json\n```\n\n### Sample Output\n\n```text\n========================================================================\n  Git Repository & Hook Doctor: /path/to/repo\n========================================================================\nID         TIER         CATEGORY               STATUS   DETAILS\n------------------------------------------------------------------------\nBASE-1     Base         Hook Wiring            PASS  core.hooksPath correctly wired to '.githooks'.\nBASE-2     Base         Permissions            PASS  All active hook files have executable permissions.\nBASE-3     Base         Pre-push Deletion      FAIL  pre-push hook lacks zero-SHA (40 zeros) branch deletion early exit.\nBASE-4     Base         Local Branch Guard     PASS  pre-push hook contains 'local' stage-branch push guard.\nBASE-5     Base         Secret & IP Guard      PASS  pre-commit hook contains secret / IP / path protection guard.\nCOND-MD    Conditional  Markdown Lint          PASS  Markdown files present and validated by hook.\nCOND-SKILL Conditional  Skill Frontmatter Lint PASS  Skill files present and verified by metadata/frontmatter lint hook.\nCOND-PUBLIC Conditional Public English Gate    PASS  Public English repository contains check-hangul gate in pre-commit.\nCOND-HOOK-REG Conditional Hook Registration    PASS  hooks.json present and hook registration integrity is wired into pre-commit and CI.\n------------------------------------------------------------------------\nSummary: 7 Passed | 0 Warnings | 1 Failed\n\n❌ Doctor found 1 issue(s). Follow details above to resolve.\n```\n\n---\n\n## Remediation Runbook\n\n### 1. Fixing Unwired `.githooks` (`BASE-1`)\n\nIf `.githooks/` directory exists but Git ignores it:\n\n```bash\ngit config core.hooksPath .githooks\n```\n\n### 2. Fixing Hook Permissions (`BASE-2`)\n\n```bash\nchmod +x .githooks/*\n```\n\n### 3. Adding Zero-SHA Early Exit (`BASE-3`)\n\nIn `.githooks/pre-push`, insert the zero-SHA check at the start of the stdin reading loop:\n\n```sh\nwhile IFS=' ' read -r local_ref local_sha remote_ref remote_sha; do\n  # Skip branch deletions immediately (prevents running heavy CI tests on branch deletion)\n  if [ \"$local_sha\" = \"0000000000000000000000000000000000000000\" ] || [ \"$local_sha\" = \"(delete)\" ] || [ \"$local_ref\" = \"(delete)\" ]; then\n    exit 0\n  fi\n\n  # Branch guards & downstream checks...\ndone\n```\n\n### 4. Adding Private / Staging Branch Push Guard (`BASE-4`)\n\nIn `.githooks/pre-push`:\n\n```sh\n# Block accidental push of private staging branches to remote (local*, wip*, scratch*)\ncase \"${local_ref#refs/heads/}\" in\n  local|local-*|local/*|wip|wip-*|wip/*|scratch|scratch-*|scratch/*)\n    if [ \"${PUSH_LOCAL_OVERRIDE:-}\" != \"1\" ]; then\n      echo \"❌ ERROR: Pushing private staging branch '$local_ref' to remote is blocked.\" >&2\n      exit 1\n    fi\n    ;;\nesac\ncase \"${remote_ref#refs/heads/}\" in\n  local|local-*|local/*|wip|wip-*|wip/*|scratch|scratch-*|scratch/*)\n    if [ \"${PUSH_LOCAL_OVERRIDE:-}\" != \"1\" ]; then\n      echo \"❌ ERROR: Pushing to remote private staging branch '$remote_ref' is blocked.\" >&2\n      exit 1\n    fi\n    ;;\nesac\n```\n\n### 5. Adding Skill Frontmatter & Language Lint (`COND-SKILL`, `COND-PUBLIC`)\n\nIn `.githooks/pre-push`:\n\n```sh\n# Verify SKILL.md frontmatter and dependencies\nif [ -f \"scripts/lint-frontmatter.sh\" ]; then\n  echo \"Checking SKILL.md frontmatter...\"\n  bash scripts/lint-frontmatter.sh\nfi\n```\n\n### 6. Adding Push Commit Limit Guard (`BASE-6`)\n\nIn `.githooks/pre-push`:\n\n```sh\n# Commit count limit guard — prevent pushing massive commits from wrong base branch\n# Exclude commits that already exist on remote tracking branches (--remotes=origin)\n# so that merged upstream/remote branches do not inflate the count of new outgoing commits.\nif [ \"$remote_sha\" != \"0000000000000000000000000000000000000000\" ] && [ -n \"$remote_sha\" ]; then\n  COMMIT_COUNT=$(git rev-list --count \"$local_sha\" --not \"$remote_sha\" --remotes=origin 2>/dev/null || echo 0)\nelse\n  DEFAULT_BASE=\"origin/main\"\n  case \"$local_ref\" in\n    refs/heads/feat/*|feat/*)\n      if git rev-parse --verify origin/next-feat >/dev/null 2>&1; then\n        DEFAULT_BASE=\"origin/next-feat\"\n      fi\n      ;;\n    refs/heads/fix/*|fix/*)\n      if git rev-parse --verify origin/next-fix >/dev/null 2>&1; then\n        DEFAULT_BASE=\"origin/next-fix\"\n      fi\n      ;;\n  esac\n\n  if [ \"$DEFAULT_BASE\" = \"origin/main\" ]; then\n    MIN_COUNT=999999\n    for cand in origin/next-feat origin/next-fix origin/main origin/master; do\n      if git rev-parse --verify \"$cand\" >/dev/null 2>&1; then\n        cnt=$(git rev-list --count \"$local_sha\" --not \"$cand\" --remotes=origin 2>/dev/null || echo 999999)\n        if [ \"$cnt\" -lt \"$MIN_COUNT\" ]; then\n          MIN_COUNT=\"$cnt\"\n          DEFAULT_BASE=\"$cand\"\n        fi\n      fi\n    done\n  fi\n  COMMIT_COUNT=$(git rev-list --count \"$local_sha\" --not \"$DEFAULT_BASE\" --remotes=origin 2>/dev/null || echo 0)\nfi\n\nMAX_COMMITS=\"${PUSH_MAX_COMMITS:-5}\"\nif [ \"$COMMIT_COUNT\" -gt \"$MAX_COMMITS\" ] && [ \"${PUSH_COMMIT_LIMIT_OVERRIDE:-0}\" != \"1\" ]; then\n  echo \"❌ ERROR: Pushing $COMMIT_COUNT commits on '$local_ref' exceeds the limit ($MAX_COMMITS).\" >&2\n  echo \"   This usually indicates a wrong base branch or diverged history.\" >&2\n  echo \"   To override: PUSH_COMMIT_LIMIT_OVERRIDE=1 git push ...\" >&2\n  exit 1\nfi\n```\n\n### 7. Adding Merge Conflict Marker Guard (`BASE-7`)\n\n**Why this happens**: `git merge --continue` (or any other non-interactive commit path, e.g. `git merge --no-edit` after resolving conflicts) commits the raw `MERGE_MSG` file verbatim. That file's `# Conflicts:` section is only stripped by Git's \"strip\" cleanup mode, which applies solely to editor-invoked commits — a non-interactive commit skips it, so the literal `# Conflicts:\\n#\\t<path>` lines end up permanently in the commit message.\n\nIn `.githooks/pre-push`, insert a scan over the outgoing commit range (reuse the `$DEFAULT_BASE`/range logic from `BASE-6` if already present):\n\n```sh\n# Conflict marker guard — block push of a commit whose message still carries\n# the auto-generated \"Conflicts:\" residue (unresolved non-interactive merge commit)\nif [ \"$remote_sha\" != \"0000000000000000000000000000000000000000\" ] && [ -n \"$remote_sha\" ]; then\n  CONFLICT_RANGE=\"$remote_sha..$local_sha\"\nelse\n  CONFLICT_RANGE=\"${DEFAULT_BASE:-origin/main}..$local_sha\"\nfi\n\nCONFLICT_COMMITS=$(git rev-list \"$CONFLICT_RANGE\" 2>/dev/null | while read -r sha; do\n  git log -1 --format='%B' \"$sha\" | grep -qE '^#?[[:space:]]*Conflicts:' && echo \"$sha\"\ndone)\n\nif [ -n \"$CONFLICT_COMMITS\" ] && [ \"${PUSH_CONFLICT_MSG_OVERRIDE:-0}\" != \"1\" ]; then\n  echo \"❌ ERROR: The following commit(s) still contain a leftover '# Conflicts:' section:\" >&2\n  echo \"$CONFLICT_COMMITS\" | sed 's/^/   /' >&2\n  echo \"   This happens when a merge is committed non-interactively (--no-edit) after resolving conflicts.\" >&2\n  echo \"   Clean the message before pushing:\" >&2\n  echo \"     - Tip commit:      git commit --amend  (drop the '# Conflicts:' lines, then save)\" >&2\n  echo \"     - Older commit:    git rebase -i <parent-sha>  -> mark it 'reword', drop the lines\" >&2\n  echo \"   To override: PUSH_CONFLICT_MSG_OVERRIDE=1 git push ...\" >&2\n  exit 1\nfi\n```\n\n### 8. Adding Hook Registration Integrity (`COND-HOOK-REG`)\n\nFor repositories that publish `hooks/hooks.json`, add a verifier that resolves\nregistered `${CLAUDE_PLUGIN_ROOT}` paths and fails on duplicate registrations,\nmissing files, or scripts checked out without executable permissions.\n\nWire it into pre-commit:\n\n```yaml\nrepos:\n  - repo: local\n    hooks:\n      - id: verify-hooks-json\n        name: Verify hook registrations\n        entry: python3 scripts/verify-hooks-json.py\n        language: system\n        pass_filenames: false\n```\n\nWire the same script into CI:\n\n```yaml\n- name: Verify hooks.json\n  run: python3 scripts/verify-hooks-json.py\n```\n\nFile v0.13.0:fix-worktree.md\n\n# Fix Worktree\n\nA tool to fix incorrect worktree configuration in ghq bare repositories.\n\n## Diagnosis (Problem Scenarios)\n\nThe following issues can occur in ghq + git worktree structures:\n- `bare = false` but `core.worktree` points to a wrong path\n- Worktree directory exists but is not registered in the bare repo\n- Incorrect `core.worktree` config causes git commands to fail\n\n## Usage\n\n### Scan and fix all bare repos\n\n```bash\nscripts/git-fix-worktree.sh\n```\n\n### Fix a specific bare repo\n\n```bash\nscripts/git-fix-worktree.sh /path/to/repo.git\n```\n\n## Fix Behavior\n\n1. **When worktree exists**: Register in bare repo's `worktrees/` directory\n2. **Worktree's `.git` file**: Fix to point to subdirectory under `worktrees/`\n3. **Index regeneration**: If missing, regenerate with `git reset HEAD -- .` or `git read-tree HEAD` (preserves uncommitted changes)\n4. **Config restoration**: Remove `core.worktree`, set `core.bare = true`\n5. **SourceGit auto-launch**: Launch SourceGit GUI on the target worktree path (`sourcegit <worktree_path>`) so the user can inspect the recovered worktree immediately.\n\n## Example Output\n\n```\nScanning for broken bare repos in: ~/ghq\nFixed: ~/ghq/github.com/es6kr/repo.git\n  Registered worktree: ~/es6kr/repo\n  Updated .git -> ~/ghq/github.com/es6kr/repo.git/worktrees/repo\n  Rebuilt index\nDone.\n```\n\n## Register Existing Directory as Worktree\n\nRegistering a directory that already contains files (metadata-only, no fresh checkout) is the shared mechanism documented in **[worktree-register](./worktree-register.md)**. Use that topic's procedure here — pass the bare/main repo as `GITDIR`, the existing directory as `WT`, and the recovered branch.\n\nThe same mechanism is reused by [to-bare](./to-bare.md) after a regular→bare conversion. Keeping it in one place avoids drift between the two flows.\n\n## Related Commands\n\n```bash\n# Check worktree status\ngit worktree list\n\n# Check bare repo configuration\ngit config -f /path/to/repo.git/config --list\n\n# Check worktree's .git file\ncat /path/to/worktree/.git\n```\n\n## Notes\n\n- Local changes (uncommitted changes) are safely preserved\n- Index regeneration is based on HEAD, so staged/unstaged files remain intact\n- The script only modifies metadata and does not delete actual files\n\nFile v0.13.0:githooks.md\n\n# githooks — why a repo's `.githooks/` silently does nothing\n\nDiagnosing \"my hook isn't running\", and choosing an install method that does not\nsilently disable the machine-wide hooks.\n\n## The three independent reasons a `.githooks/` hook is ignored\n\nCheck all three — they compound, and fixing only one leaves the hook dead.\n\n| # | Cause | Check | Symptom |\n|---|-------|-------|---------|\n| 1 | `core.hooksPath` points elsewhere | `git config --get core.hooksPath` | git reads ONLY that directory — both `.githooks/` and `.git/hooks/` are bypassed |\n| 2 | `.githooks/` is not a git convention | — | git never auto-discovers `.githooks/`. It is a naming convention that requires an explicit `core.hooksPath=.githooks` per repo (git 2.9+) |\n| 3 | Hook file lacks the execute bit | `ls -l .githooks/<hook>` | git skips non-executable hooks **silently** — no warning, no error |\n\nDiagnostic sequence:\n\n```bash\nR=<repo>\ngit -C \"$R\" config --local  --get core.hooksPath   # repo-level override\ngit config --global --get core.hooksPath           # machine-wide default\ngit config --system --get core.hooksPath\ngit -C \"$R\" rev-parse --git-path hooks             # the directory git will actually read\nls -l \"$R/.githooks/\"                              # execute bit present?\n```\n\n`rev-parse --git-path hooks` is the authoritative answer to \"which directory does\ngit read for this repo\" — it already resolves the local/global/system precedence.\n\n## When a machine-wide `core.hooksPath` is in play\n\nA global `core.hooksPath` disables every repo's `.git/hooks/` too, which would break\nrepos that already had local hooks. The usual mitigation is a **passthrough chain**:\neach hook in the global directory re-executes the repo's own hook of the same name.\n\n```bash\n# A passthrough hook, copied under each hook name in the global hooks directory\nHOOK_NAME=\"$(basename \"$0\")\"\nLOCAL_HOOK=\"$(git rev-parse --absolute-git-dir 2>/dev/null)/hooks/$HOOK_NAME\"\nif [ -x \"$LOCAL_HOOK\" ] && [ \"$LOCAL_HOOK\" != \"$0\" ]; then\n  exec \"$LOCAL_HOOK\" \"$@\"\nfi\nexit 0\n```\n\nTwo properties matter when reasoning about such a setup:\n\n- The chain forwards to **`.git/hooks/<name>`**, never to `.githooks/<name>`. A repo\n  that keeps hooks in `.githooks/` gets nothing from the chain.\n- Hooks that carry real validation logic run their own checks **first** and only then\n  fall through to the same chain block. So a repo-local hook of that name runs *in\n  addition to* the global validation, not instead of it.\n\nClassify the global hooks before deciding anything — passthrough stubs and real\nvalidators behave differently:\n\n```bash\nH=\"$(git config --global --get core.hooksPath)\"\nfor f in \"$H\"/*; do\n  cmp -s \"$f\" \"$H/_chain\" && kind=passthrough || kind=REAL\n  printf '%-24s %6sB  %s\\n' \"$(basename \"$f\")\" \"$(wc -c <\"$f\" | tr -d ' ')\" \"$kind\"\ndone\n```\n\nIdentical byte size to the passthrough template is the quick tell; `cmp` confirms it.\n\n## Install method trade-off (HARD STOP — read before setting `core.hooksPath` locally)\n\n`core.hooksPath` holds a **single value**. Setting it locally *replaces* the global\none — it does not layer. Any validation living in the global hooks directory stops\nrunning for that repo, silently.\n\n| Method | Global hooks | Version-controlled | Failure mode |\n|--------|--------------|--------------------|--------------|\n| `git config core.hooksPath .githooks` | **Lost** (local value replaces global) | Yes | Machine-wide validators (commit-message format, push gates) silently stop for this repo |\n| Copy `.githooks/*` → `.git/hooks/` | Kept (passthrough chain re-executes them) | No — `.git/` is not tracked | Drift: editing `.githooks/` does not propagate; a fresh clone has no hooks until someone re-runs the install step |\n| Local `core.hooksPath=.githooks` + shim | Kept | Yes | Needs one shim per global hook name; shim path is machine-specific |\n\nThe shim is the third option that most write-ups omit — keep the tracked directory\n*and* the global validation:\n\n```bash\n# .githooks/commit-msg\n#!/bin/bash\nexec \"$(git config --global --get core.hooksPath)/commit-msg\" \"$@\"\n```\n\n| # | Don't | Do |\n|---|-------|-----|\n| 1 | Set `core.hooksPath` locally without first listing what the global hooks directory contains | Classify global hooks (passthrough vs real) first — only then decide whether losing them is acceptable |\n| 2 | Assume `.githooks/` works because the repo next door has it | That repo has a **local** `core.hooksPath`. Confirm with `git -C <repo> rev-parse --git-path hooks` |\n| 3 | Disable a machine-wide validator by repointing `core.hooksPath`, when the validator has a per-repo opt-out | Check the validator for an opt-out switch (`git config --get hooks.<name>` style) and use that instead |\n| 4 | Copy-install and consider it done | Copy-install has no propagation. Record the install step somewhere the next clone will see it, and re-run it after editing `.githooks/` |\n| 5 | Debug a non-firing hook by reading its body | Check the execute bit first — a non-executable hook fails silently, and the passthrough chain's `[ -x ... ]` test skips it too |\n\n## Self-check (before changing any hook wiring)\n\n1. Which directory does git actually read? — `git rev-parse --git-path hooks`\n2. If a global `core.hooksPath` exists, which of its hooks are real validators vs passthrough stubs?\n3. Does the change drop any real validator for this repo? If yes, is there a per-repo opt-out that expresses the intent more narrowly?\n4. Are the hook files executable?\n5. If copy-installing, where is the re-run step recorded so the next clone (and the next edit of `.githooks/`) does not silently regress?\n\n## Worked example (2026-08-17)\n\nA repo's `.githooks/pre-commit` (a guard blocking an untracked tracker file from\nbeing staged) had never fired. All three causes were present at once:\n\n- global `core.hooksPath` was set, so `.githooks/` was never read\n- the global `pre-commit` was a passthrough stub forwarding to `.git/hooks/pre-commit`,\n  which did not exist in that repo\n- the hook file was `-rw-r--r--` — no execute bit\n\nA sibling repo in the same workspace *did* work, because it had a **local**\n`core.hooksPath=.githooks` and executable hooks. That same local override, though,\nmeant its commits bypassed the machine-wide commit-message validator entirely: its\n`.githooks/` contained only `pre-commit` and `pre-push`, no `commit-msg`. Neither\nrepo's owner had noticed either effect, which is the whole hazard — every failure\nmode in this topic is silent.\n\nFile v0.13.0:isolate-hunk.md\n\n# Isolate Hunk\n\nStage only your own edit to a tracked file whose working tree copy also carries unrelated uncommitted content — without touching that other content at all.\n\n## When to use\n\n- The repo is a shared skills monorepo and another session/device has concurrent work-in-progress in a file you also need to edit\n- `git status` shows the file as modified, but `git diff` reveals hunks you never wrote mixed in with your own\n- You need to commit and PR your change now, without waiting for the other work to land or reviewing it yourself\n\nNaive `git add <path>` would stage the entire working-tree file, bundling the unrelated content into your commit. This topic isolates just your hunk.\n\n## Procedure\n\n### 1. Identify which hunks are yours\n\n```bash\ngit -C <repo> diff <path>\n```\n\nRead every hunk. A hunk is **yours** only if you made that exact edit this session (via Edit/Write). Anything else — even if it looks plausible — belongs to whoever else is working on the file.\n\nIf unsure whether a hunk is yours, check its content against what you actually wrote (your Edit tool call's `old_string`/`new_string`), not against what \"looks right.\"\n\n### 2. Extract the HEAD baseline and your intended content\n\n```bash\ngit -C <repo> show HEAD:<path> > /tmp/base.md\n```\n\nBuild a target file = HEAD baseline + only your insertion(s), anchored on surrounding text you can locate exactly in the baseline. This step is inherently manual — it depends on knowing your own edit's exact anchor and inserted text, not something a generic script can infer.\n\nA safe way to build the target programmatically (avoids shell quoting issues with multi-line Markdown content):\n\n```python\nhead = open(\"/tmp/base.md\", encoding=\"utf-8\").read().splitlines(keepends=True)\nanchor = \"<exact line from the baseline that precedes your insertion>\\n\"\nidx = head.index(anchor)\nmy_insertion = \"<your exact inserted lines>\\n\"\ntarget = head[:idx+1] + my_insertion.splitlines(keepends=True) + head[idx+1:]\nopen(\"/tmp/target.md\", \"w\", encoding=\"utf-8\", newline=\"\").writelines(target)\n```\n\n### 3. Verify the target contains only your change\n\n```bash\ndiff /tmp/base.md /tmp/target.md\n```\n\nEvery line in this diff should be something you recognize as your own edit. If anything unexpected appears, the anchor or insertion text was wrong — fix it before continuing.\n\n### 4. Stage the isolated content\n\n```bash\nscripts/stage-isolated-content.sh <repo> <path> /tmp/target.md\n```\n\nThis creates a git blob from `/tmp/target.md` and points the index entry for `<path>` at it — the working tree file (still containing the other session's untouched content) is never modified.\n\n### 5. Commit and verify the working tree is untouched\n\n```bash\ngit -C <repo> commit -m \"<type>(<scope>): <summary>\"\ngit -C <repo> diff <path>   # should show the SAME unrelated hunks as before — proof nothing was disturbed\n```\n\nThe post-commit `git diff` should show exactly the other session's content as still-uncommitted — confirming your commit captured only your change and left everything else in place.\n\n## Repeat for multiple files\n\nIf several files each mix your edits with unrelated content, run steps 1-4 for each file before committing — `git commit` picks up everything currently staged in one pass. Unstage a file (`git reset <path>`) if you want it in a separate commit instead.\n\n## Don't / Do\n\n| # | Don't | Do |\n|---|-------|-----|\n| 1 | `git add <path>` when the working tree mixes your edit with someone else's uncommitted content | Build an isolated target (steps 2-3) and stage it via `stage-isolated-content.sh` |\n| 2 | Assume a hunk is \"probably fine to include\" because it looks reasonable | Only include hunks you can trace to your own Edit/Write calls this session |\n| 3 | Revert or overwrite the other session's working-tree content to \"clean up\" before committing | Never touch working-tree content you didn't write — the whole point of this technique is to leave it untouched |\n| 4 | Skip the post-commit `git diff` check | Always verify the other content is still present and unstaged after your commit |\n\n## Self-check (before running `stage-isolated-content.sh`)\n\n1. Did you read every hunk in `git diff <path>` and classify each as yours or not?\n2. Does your target file's diff against HEAD (step 3) contain only lines you recognize as your own edit?\n3. After staging, does `git show :<path>` match your target file exactly?\n4. After committing, does `git diff <path>` still show the other session's hunks as uncommitted (proof the working tree was never touched)?\n\nFile v0.13.0:merge-duplicate.md\n\n# Merge Duplicate Repositories\n\nWorkflow for merging two local repositories that point to the same origin into one.\n\n## When to Use\n\n- Two repositories with the same origin exist at different paths in ghq\n- Duplicate occurred due to mismatch between local path and origin path\n\n## Workflow\n\n### Step 1: Pre-check\n\n```bash\n# Compare HEAD of both repositories\ngit -C <src> rev-parse HEAD\ngit -C <dst> rev-parse HEAD\n\n# Check src repository status\ngit -C <src> stash list\ngit -C <src> branch -v\ngit -C <src> status --short\ngit -C <src> tag -l\n```\n\n**AskUserQuestion required if stash or unpushed branches exist**\n\n### Step 2: Temporary commit + tag in src repository\n\nIf src has uncommitted/untracked changes, preserve with a temporary commit:\n\n```bash\ncd <src>\ngit add -A  # -A allowed for temporary preservation purposes\ngit commit -m \"temp: preserve local changes before migration\"\ngit tag merge-backup-$(date +%Y%m%d)\n```\n\nWorking tree becomes clean after commit.\n\n### Step 3: Add src as remote to dst repository and transfer tags\n\n```bash\ncd <dst>\ngit remote add merge-src <src-path>\ngit fetch merge-src --tags\ngit remote remove merge-src\n```\n\nNow dst has the merge-backup tag — recovery possible later.\n\n### Step 4: Move files from src to dst (mv)\n\nCheck unique files/changes in src and **mv** to dst:\n\n```bash\n# Check files included in the temporary commit:\ngit -C <dst> show merge-backup-YYYYMMDD --stat\n\n# Move necessary files with mv\nmv <src>/unique-file <dst>/\n```\n\n**Never use cp/rsync** — use mv only.\n**AskUserQuestion required** if files to move also exist in dst.\n\n### Step 5: Clean up src directory (rmdir)\n\nRemove empty folders after all files have been moved:\n\n```bash\n# Check .git file/directory\nls -la <src>/.git\n\n# If .git is a file (gitdir pointer), delete it\nrm -f <src>/.git\n\n# If .git is a directory (actual repository):\n#   - Verify tags were transferred to dst\n#   - git -C <dst> tag -l | grep merge-backup\n#   - After verification: rm -rf <src>/.git (AskUserQuestion required)\n\n# Remove empty folders (bottom-up)\nfind <src> -type d -empty -delete\n# src directory itself will be auto-deleted if empty\n```\n\n**Do not rm -rf the entire src** — it should naturally disappear via mv + rmdir.\n**AskUserQuestion required** if files remain after rmdir/find -empty -delete.\n\n### Step 6: Update SourceGit\n\n- Remove src path entry\n- Verify dst path is correctly registered\n\n## Safety Rules\n\n- **Before deleting src**: always check stash, unpushed branches/tags\n- **Preserve temporary commits with tags** — verify tag transfer to dst\n- **Use mv only** — cp/rsync/find -delete prohibited\n- **rm -rf prohibited** — natural elimination via mv + rmdir\n- When in doubt, **AskUserQuestion**\n\nArchive v0.12.1: 39 files, 116006 bytes\n\nFiles: CHANGELOG.md (17117b), clone.md (5209b), conflict-dry-run.md (5735b), credential-helper.md (6730b), doctor.md (13778b), fix-worktree.md (2263b), githooks.md (6504b), isolate-hunk.md (4551b), LICENSE (1063b), merge-duplicate.md (2710b), migrate.md (459b), move-worktree.md (5485b), patrol.md (6071b), README.md (597b), rebase-audit.md (13511b), rename-worktree.md (9791b), safe-relocate.md (2570b), scripts/check-worktree-canonical.sh (6008b), scripts/git-fix-worktree.sh (2513b), scripts/git-repo-doctor.sh (18660b), scripts/local-to-staging-pr.sh (8829b), scripts/prune_merged_worktrees.py (15175b), scripts/rename-worktree.sh (6840b), scripts/repo-to-bare-worktree.sh (5118b), scripts/repo-to-ghq.sh (7470b), scripts/stage-isolated-content.sh (2441b), skill-card.md (2027b), SKILL.md (17522b), sourcegit.md (5456b), ssh-key.md (5244b), tests/test_prune_merged_worktrees.py (8267b), tests/test-check-worktree-canonical.sh (3791b), tests/test-git-repo-doctor.sh (18680b), to-bare.md (4235b), to-ghq.md (6532b), worktree-drift-sync.md (3736b), worktree-register.md (4216b), worktree.md (40103b), _meta.json (128b)\n\nFile v0.12.1:SKILL.md\n\n---\nname: git-repo\nmetadata:\n  author: es6kr\n  version: \"0.1.2\"\ndepends-on:\n  - commit-tidy\ndescription: |\n  Git repository and SourceGit integration. Topics — clone (ghq), conflict-dry-run (isolated merge test), credential-helper (multi-account HTTPS token), doctor (hook health & compliance audit — Tier 1 Base + Tier 2 Conditional taxonomy), fix-worktree (bare repo recovery), githooks (hook silently never runs — hooksPath precedence, passthrough chain, install trade-off), isolate-hunk (stage own edit amid unrelated content), merge-duplicate, rebase-audit (accidental-revert detection during an active rebase), to-ghq (formerly migrate), to-bare, worktree-register (metadata register/relink), patrol (batch inspect), move-worktree (register/reclaim merged PR), rename-worktree, safe-relocate (relocate commits onto a clean base branch), sourcegit, ssh-key (multi-account SSH map), worktree (inventory + reuse + create), worktree-drift-sync (mirror fix across worktrees safely). Use when: \"reuse worktree\", \"multi-account clone\", \"Repository not found\", \"wrong account\", \"concurrent uncommitted edit\", \"accidental revert\", \"githooks ignored\", \"hook not running\", \"core.hooksPath\", \"hook not firing\", \"repo doctor\", \"hook health\", \"diagnose hooks\", \"check hooks\" triggers.\nallowed-tools:\n  - Read\n  - Edit\n  - Write\n  - Bash(ghq:*)\n  - Bash(git:*)\n  - Bash(mv:*)\n  - Bash(ls:*)\n  - Bash(pgrep:*)\n  - Bash(cat:*)\n---\n\n# Git Repo\n\nGit repository management and SourceGit GUI client integration.\n\n## Topics\n\n| Topic | Description | Guide |\n|-------|-------------|-------|\n| clone | ghq get with automatic SourceGit registration (multi-account support) | [clone.md](./clone.md) |\n| conflict-dry-run | test merge/cherry-pick applicability in an isolated worktree, without touching the main working tree | [conflict-dry-run.md](./conflict-dry-run.md) |\n| credential-helper | pin a per-org GitHub token for HTTPS remotes (fixes recurring `Repository not found` from active-account mismatch); HTTPS counterpart to ssh-key | [credential-helper.md](./credential-helper.md) |\n| doctor | diagnose Git repository hook health, wiring, permissions, and CI compliance (Base universal + Conditional domain/type taxonomy; helper: `scripts/git-repo-doctor.sh`) | [doctor.md](./doctor.md) |\n| fix-worktree | bare repo worktree configuration recovery | [fix-worktree.md](./fix-worktree.md) |\n| githooks | diagnose a `.githooks/` hook that silently never runs (hooksPath precedence, passthrough chains, execute bit) and choose an install method that keeps machine-wide hooks | [githooks.md](./githooks.md) |\n| isolate-hunk | stage only your own edit when a tracked file's working tree mixes it with unrelated uncommitted content, via git plumbing (no working-tree changes) | [isolate-hunk.md](./isolate-hunk.md) |\n| merge-duplicate | merge duplicate repositories with the same origin | [merge-duplicate.md](./merge-duplicate.md) |\n| migrate | **renamed → to-ghq** (backward-compat alias) | [migrate.md](./migrate.md) |\n| move-worktree | move/register unregistered worktrees to .claude/worktrees/, reclaim merged PR worktrees | [move-worktree.md](./move-worktree.md) |\n| patrol | batch inspection of ghq repositories (status, stash, unpushed + commit-splitter integration) | [patrol.md](./patrol.md) |\n| rebase-audit | audit an active interactive rebase's staged files for accidental reverts (HEAD-vs-index diff + revert-pattern heuristic + AskUserQuestion multiSelect) without touching the rebase itself | [rebase-audit.md](./rebase-audit.md) |\n| rename-worktree | rename worktree directory and metadata (cross-platform, Windows safe) | [rename-worktree.md](./rename-worktree.md) |\n| safe-relocate | relocate working commits from a stale, diverged, or dirty branch onto a clean branch cut directly off the latest remote base (5-step procedure) | [safe-relocate.md](./safe-relocate.md) |\n| sourcegit | SourceGit preference.json management (add repos, workspaces, folder rename) | [sourcegit.md](./sourcegit.md) |\n| ssh-key | per-repo SSH key mapping for multi-account GitHub (core.sshCommand + IdentityAgent) | [ssh-key.md](./ssh-key.md) |\n| 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-bare.md) |\n| to-ghq | migrate bare+worktree → regular `.git` at the ghq path (formerly `migrate`) | [to-ghq.md](./to-ghq.md) |\n| worktree | unified worktree acquisition: inventory, reuse inactive, or create new at `.claude/worktrees/` | [worktree.md](./worktree.md) |\n| worktree-drift-sync | re-verify each worktree's git state immediately before/after applying an identical fix across a repo's multiple worktrees under external concurrent editing | [worktree-drift-sync.md](./worktree-drift-sync.md) |\n| worktree-register | shared: register a populated directory as a worktree via metadata only (used by fix-worktree + to-bare) | [worktree-register.md](./worktree-register.md) |\n\n## Topic Dependencies\n\n```\nworktree (entry point — inventory + decision)\n  └─→ rename-worktree (reuse registered worktree)\n  └─→ move-worktree (register unregistered or relocate)\n\nworktree-register (shared metadata register/relink mechanism)\n  ├─← fix-worktree (recover a broken bare-worktree link)\n  └─← to-bare (link the working tree after a regular→bare conversion)\n\nto-bare  ←inverse→  to-ghq (formerly `migrate`)\n\nssh-key (SSH multi-account)  ──counterpart──  credential-helper (HTTPS multi-account)\n\nrebase-audit (active-rebase revert detection)  ──restoration mechanism shared with──  isolate-hunk (targeted hunk staging)\n```\n\n## Worktree decision tree (HARD STOP — every time a worktree is needed)\n\n**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.**\n\n### Flow\n\n1. `git -C <repo> worktree list` to enumerate existing worktrees\n2. **Operation-state gate (HARD STOP — before any inactive classification)**: for each candidate worktree `<W>`, check for an in-progress git operation:\n   ```bash\n   gitdir=$(git -C <W> rev-parse --absolute-git-dir)\n   ls \"$gitdir\"/CHERRY_PICK_HEAD \"$gitdir\"/MERGE_HEAD \"$gitdir\"/REBASE_HEAD \"$gitdir\"/BISECT_LOG \"$gitdir\"/rebase-merge \"$gitdir\"/rebase-apply 2>/dev/null\n   git -C <W> status --porcelain | grep -E '^(DD|AU|UD|UA|DU|AA|UU)'   # unmerged index entries\n   ```\n   Any hit = a cherry-pick/merge/rebase/bisect is **mid-flight** (likely the user's active operation) → the worktree is **NOT an inactive candidate**, its dirty files are the operation's payload (never offer discard / `git add` resolution / stash), and reuse is forbidden — report to the user instead. Merge-status heuristics (branch merged + ahead=0) do NOT override this gate. (see failed-attempts.md \"cherry-pick in progress misclassified as abandoned\")\n3. Identify inactive candidates (only among worktrees that passed the gate):\n   - **Merged-PR worktrees** (commit hash equals the base branch's merge commit)\n   - **Squash-merged-PR worktrees** — see the caveat below; the hash test above does **not** find these\n   - **Stale fix/refactor branch worktrees** (confirm with the user)\n\n   **Hash-equality misses every squash merge (HARD STOP)**: a squash merge creates a new single commit on the base with no parent link to the branch, so a worktree whose PR was squashed keeps a HEAD that matches nothing on the base. The test in the first bullet reports it as *not* merged, and its N original commits still read as unmerged work — which both hides a reclaimable worktree and, worse, makes a genuinely stale branch look active. Ask GitHub for the PR state instead of inferring it from hashes:\n\n   ```bash\n   B=$(git -C <worktree> branch --show-current)\n   gh pr list --head \"$B\" --state all --json number,state,mergedAt --jq '.[0]'\n   ```\n\n   | PR state for the worktree's branch | Classification |\n   |------------------------------------|----------------|\n   | `MERGED` (regardless of merge method) | Inactive candidate — reclaimable |\n   | `OPEN` | Active — not a candidate |\n   | `CLOSED` unmerged, or no PR | Stale candidate — confirm with the user before reuse |\n\n   For a `MERGED` squashed branch, reuse means re-pointing the worktree at a fresh branch off the updated base (`rename-worktree`) — do **not** rebase or merge the old branch forward, since its commits duplicate content the base already carries in squashed form.\n\n   **Batch cleanup**: `scripts/prune_merged_worktrees.py` automates this same `gh pr list --head` check (with a git-native `merge-base --is-ancestor` fallback when `gh` is unavailable) across every non-main worktree in a repository at once — use it instead of the manual per-worktree steps above when clearing out several stale worktrees. Defaults to `--dry-run`; pass `--execute` to actually remove eligible worktrees, `-d`/`--delete-branch` to also delete the local branch, `--scan <root>` to sweep multiple repositories.\n4. If an inactive worktree exists → **reuse via the `rename-worktree` topic** (rename the directory + metadata, switch branch)\n5. If no inactive worktree exists or the user opts for new → `git worktree add`\n\n### New-commit-start trigger (HARD STOP — paired with git.md)\n\n**When committing new work on a main/master/develop branch, if `git status` shows uncommitted changes from another task, worktree splitting is mandatory.**\n\n#### Entry conditions (any one)\n\n- Current branch = main/master/develop\n- `git status` shows 1+ changed files outside the new work (e.g., another task's unstaged files)\n- Unpushed commits include another task's work\n\n#### Decision tree on entry\n\n```\ngit status (check for other changes)\n  ├─ 0 other changes, branch = PR/feature → commit in place\n  ├─ 0 other changes, branch = main/master/develop\n  │    → AskUserQuestion: (a) create PR branch from current (b) create PR branch in a new worktree\n  ├─ 1+ other changes, branch = main/master/develop\n  │    → worktree split required. Leave other changes in place, isolate new work in a new worktree\n  └─ Another task running on a PR branch with stray changes on main\n       → Report to the user (confirm intent of stray changes) → decide worktree split + stray cleanup\n```\n\n#### Worktree split procedure\n\n1. Leave the new work's diff in place — do NOT stash (preserve the working directory)\n2. `git -C <repo> worktree list` to inspect inactive worktrees (per the decision tree above)\n3. Inactive candidate present → reuse via `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\")\n4. cd into the new worktree, then `git checkout -b <new-branch>` (or use the existing inactive branch)\n5. **Re-apply the same diff in the new worktree via Edit** (the original main changes stay on main)\n6. add → commit → push → PR inside the new worktree\n\n#### Don't / Do\n\n| # | Don't | Do |\n|---|-------|-----|\n| 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 |\n| 2 | Hide other changes with `git stash` and commit on main | stash breaks the other task's intent/sequence. Worktree split is safer |\n| 3 | Assume \"my changes only — no conflict\" | Other working-directory changes can spill over (tests, builds, IDE state) |\n| 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 |\n\n### Don't / Do\n\n| # | Don't | Do |\n|---|-------|-----|\n| 1 | Default to `git worktree add <path> <branch>` whenever a worktree is needed | `git worktree list` first → check inactive candidates → consider `rename-worktree` |\n| 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 |\n| 3 | AskUserQuestion options offer only \"create new worktree\" | Include \"reuse an existing worktree by rename\" whenever an inactive worktree exists |\n| 4 | Decide on the worktree autonomously before asking the user | When inactive candidates exist, ask which one to reuse |\n| 5 | Ignore merged-PR worktrees | Reclaim them with move-worktree or rename-worktree |\n| 6 | **Place \"create new worktree\" as option 1/Recommended when inactive candidates exist** | **Reuse is Recommended/option 1.** New is option 2 or below |\n| 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 |\n\n### Recommended placement rule (HARD STOP — prevent 2nd recurrence)\n\n**When building AskUserQuestion options for worktree selection**:\n\n| Inactive candidates | Option order + Recommended |\n|--------------|------------------------|\n| 0 | Option 1: New worktree (Recommended). Option 2: Hold |\n| 1 | **Option 1: Reuse inactive by rename (Recommended)**. Option 2: New worktree. Option 3: Hold |\n| 2+ | **Option 1: Rename inactive A (Recommended)**. Option 2: Rename inactive B. Option 3: New worktree. Option 4: Hold |\n\n**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.\n\n### Self-check (before any worktree work)\n\n1. Did you call `git -C <repo> worktree list`?\n2. **Did you run the operation-state gate (Flow step 2) on every candidate?** A worktree with `CHERRY_PICK_HEAD`/`MERGE_HEAD`/`REBASE_HEAD` or unmerged status codes (DU/UU/AA…) is mid-operation → excluded from candidates, no discard/stash options for its files\n3. Does any gated worktree match (a) the same commit as HEAD or (b) a merge commit hash? → inactive candidate\n4. If inactive candidates exist, include both the new-add option and the reuse option in AskUserQuestion\n5. **Is the Recommended marker attached to the reuse option?** (apply the \"Recommended placement rule\" table)\n6. Use new-add only when 0 inactive candidates exist OR the user explicitly chose new\n\n### Typical failure mode\n\nWhen 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.\n\n## Quick Reference\n\n### ghq Clone (automatic SourceGit registration)\n\nWhen `ghq get <url>` is executed, the following happens automatically:\n1. Clone the repository\n2. Register in SourceGit (under the appropriate group)\n3. Auto-create the group if it doesn't exist\n\n**Proceeds automatically without user confirmation**\n\n[Detailed guide](./clone.md)\n\n### SourceGit Management\n\nDirectly edit the SourceGit GUI client's configuration file to add repositories, create workspaces, rename folders, etc.\n\nKey features:\n- Add/remove repositories\n- Create workspaces\n- Sync ghq repositories\n- Update paths on folder rename\n\n[Detailed guide](./sourcegit.md)\n\n### ghq Migration (to-ghq) / Bare conversion (to-bare)\n\n- **to-ghq** (formerly `migrate`): bare+worktree → regular `.git` at the ghq path (`~/ghq/host/group/repo/`). Auto bare+worktree conversion, optional symlink, nested groups. [Detailed guide](./to-ghq.md)\n- **to-bare** (inverse): regular repo → bare + worktree at a custom location (e.g. `.claude/worktrees/`), preserving uncommitted changes. Includes a Windows lock pre-check (SourceGit/VS Code handle on `.git` blocks the rename). [Detailed guide](./to-bare.md)\n\n### Repo Patrol (batch inspection)\n\nBatch inspect and clean up the status of repositories under ghq.\n\nKey features:\n- Parallel collection of status, stash, unpushed for all repositories\n- Status-based processing (commit-splitter integration, stash pop, push)\n- Optional fetch all at the end\n\n[Detailed guide](./patrol.md)\n\n## Common Workflow\n\n1. **Repository migration**: Migrate to ghq structure with `to-ghq` topic (or `to-bare` for the inverse)\n2. **SourceGit update**: Register new paths with `sourcegit` topic\n3. **Batch inspection**: Clean up uncommitted/unpushed changes with `patrol` topic\n4. **Baseline .gitignore hygiene**: Ensure standard ignore rules (`.worktrees/`, `.DS_Store`, `__pycache__/`, `*.bak`, `*.tmp`) in `.gitignore` or `.git/info/exclude` to isolate worktrees and suppress runtime/editor clutter\n\n## Scripts\n\n- `./scripts/repo-to-ghq.sh` - Move a repository to the ghq path (bare+worktree → regular)\n- `./scripts/repo-to-bare-worktree.sh` - Convert a regular repo → bare + worktree (inverse)\n- `skills/git-repo/scripts/local-to-staging-pr.sh` - Cherry-pick local commit to a staging branch; prints manual push/PR commands by default, or pass `--push [--body-file <path>]` to also push and open the draft PR.\n- `skills/git-repo/scripts/prune_merged_worktrees.py` - Detect and safely remove clean worktrees whose branches are already merged (GitHub PR lookup + git-native ancestry fallback); defaults to `--dry-run`. See the \"Worktree decision tree\" squash-merge caveat above.\n\nFile v0.12.1:README.md\n\n# git-repo\n\nGit repository and worktree management with SourceGit integration — clone via ghq, inventory/reuse/create worktrees, convert repos to bare, and handle multi-account SSH and credentials.\n\n## Installation\n\n```bash\nnpx skills add es6kr/skills --skill git-repo\n```\n\nBrowse on ClawHub: <https://clawhub.ai/skills/git-repo>\n\n### Peer skills\n\n`git-repo` depends on `commit-tidy`. Install it too:\n\n```bash\nnpx skills add es6kr/skills --skill commit-tidy\n```\n\n## Usage\n\nInvoke with `/git-repo <topic>` (for example `/git-repo worktree`). See [`SKILL.md`](./SKILL.md) for the full topic list.\n\nFile v0.12.1:_meta.json\n\n{\n  \"ownerId\": \"kn74k8yfvftx6f062qa8fzyd8h8373jd\",\n  \"slug\": \"git-repo\",\n  \"version\": \"0.12.1\",\n  \"publishedAt\": 1791273356402\n}\n\nFile v0.12.1:CHANGELOG.md\n\n# Changelog\n\n## [0.12.1](https://github.com/es6kr/skills/compare/git-repo-v0.12.0...git-repo-v0.12.1) (2026-10-04)\n\n\n### Bug Fixes\n\n* **git-repo:** add COND-HOOK-REG check for hooks.json integrity in doctor ([#590](https://github.com/es6kr/skills/issues/590)) ([f79bd24](https://github.com/es6kr/skills/commit/f79bd24bc783f488fcab834137efbbf485e579df))\n* **git-repo:** document bash-guard-safe resolution for proven-redundant rebase picks ([a085426](https://github.com/es6kr/skills/commit/a08542616db356db9d4dba63cef72d420d4c40c0))\n* **git-repo:** document upstream-tracking gotcha when branching off a remote-tracking ref ([#583](https://github.com/es6kr/skills/issues/583)) ([04004f9](https://github.com/es6kr/skills/commit/04004f9c506f8b99598b8ea25deb0e928ab632c4))\n* **git-repo:** register safe-relocate in the Topics table ([#591](https://github.com/es6kr/skills/issues/591)) ([6eddf07](https://github.com/es6kr/skills/commit/6eddf079e242fcdae4a3dd94de01410ffb6cbf82))\n\n## [0.12.0](https://github.com/es6kr/skills/compare/git-repo-v0.11.1...git-repo-v0.12.0) (2026-09-24)\n\n\n### Features\n\n* **fix-plan:** add pipeline log and hook integrity check scripts ([e93a432](https://github.com/es6kr/skills/commit/e93a4323b54a311fcda6855163ffe14c2c146412))\n* **git-repo:** add prune_merged_worktrees.py script and guide ([37e6f16](https://github.com/es6kr/skills/commit/37e6f16474701606c4819c28ce480117dbc3b940))\n\n\n### Bug Fixes\n\n* **git-repo:** add prune_merged_worktrees.py + 7 accumulated fixes ([3d2ee94](https://github.com/es6kr/skills/commit/3d2ee9425285347d8f7e7698049d6e5769f73f92))\n* **git-repo:** document prune_merged_worktrees.py in the worktree decision tree and Scripts list ([bb979ca](https://github.com/es6kr/skills/commit/bb979ca3dcd1e4c03aa39e594134bff6d4163eba))\n* **git-repo:** refine repo scan logic to accurately detect root git repositories ([f970a45](https://github.com/es6kr/skills/commit/f970a45f9c9cc3464473052de3ee69a51235369b))\n* **git-repo:** require exact HEAD SHA match before pruning a GitHub-merged worktree ([3d9b7fa](https://github.com/es6kr/skills/commit/3d9b7fae427f484640e05a837394a8eb3f9f3736))\n\n## [0.11.1](https://github.com/es6kr/skills/compare/git-repo-v0.11.0...git-repo-v0.11.1) (2026-09-18)\n\n\n### Bug Fixes\n\n* **cleanup:** make the session-end report table self-sufficient ([#487](https://github.com/es6kr/skills/issues/487)) ([c4a0255](https://github.com/es6kr/skills/commit/c4a02557fb8de3b32cf337c549f62535dabf824b))\n* **git-repo:** stop SIGPIPE from silently disabling every Tier 2 doctor check ([#484](https://github.com/es6kr/skills/issues/484)) ([ab5a64d](https://github.com/es6kr/skills/commit/ab5a64d6c25cf7ab560c4e9b47c860bac94d7fc2))\n\n## [0.11.0](https://github.com/es6kr/skills/compare/git-repo-v0.10.1...git-repo-v0.11.0) (2026-09-06)\n\n\n### Features\n\n* **works-config:** implement v0.2.0 role-based resolution & neutral SSOT guards config ([9dff5c3](https://github.com/es6kr/skills/commit/9dff5c337812dcb23ebb45f7734801f50c9b82c0))\n\n## [0.10.1](https://github.com/es6kr/skills/compare/git-repo-v0.10.0...git-repo-v0.10.1) (2026-09-01)\n\n\n### Bug Fixes\n\n* **git-repo:** add BASE-7 conflict marker guard to doctor topic ([79fe2b5](https://github.com/es6kr/skills/commit/79fe2b5d795cff905f9199f308347b3273bbd82c))\n* **git-repo:** document clobbered-branch-pointer recovery in rebase-audit ([#396](https://github.com/es6kr/skills/issues/396)) ([69b346f](https://github.com/es6kr/skills/commit/69b346fd382c8c3c4f25c9b407358b579fea304e))\n* **git-repo:** document COND-MD-STYLE in the doctor topic ([190b9c1](https://github.com/es6kr/skills/commit/190b9c1a3f7abb842ab443a5e9d261a99f7db71f))\n* staging branch next-fix sync into main ([bbbd460](https://github.com/es6kr/skills/commit/bbbd460bf3b6b1cba4c6d07b3641afa734c89860))\n\n## [0.10.0](https://github.com/es6kr/skills/compare/git-repo-v0.9.1...git-repo-v0.10.0) (2026-08-29)\n\n\n### Features\n\n* **git-repo:** add push commit count limit guard (BASE-6) to doctor and pre-push hook ([#383](https://github.com/es6kr/skills/issues/383)) ([3dde967](https://github.com/es6kr/skills/commit/3dde96749923f2c59788981b3133e7b922c0677d))\n* promote next-feat batch (backlog skill, hooks JS port, git-repo doctor, pre-push guard) ([0d76a4c](https://github.com/es6kr/skills/commit/0d76a4c01180fbdc78bfeec8dea91373b4912470))\n\n\n### Bug Fixes\n\n* address CodeRabbit and Copilot review feedback on PR [#385](https://github.com/es6kr/skills/issues/385) ([e94de34](https://github.com/es6kr/skills/commit/e94de34ce5e075c79b7edc5d672813cea94a0acc))\n* **git-repo:** exclude existing remote tracking commits in pre-push commit count limit guard ([2c5a793](https://github.com/es6kr/skills/commit/2c5a79369d43d41d6995668baf83fab7478ff0ea))\n* **git-repo:** refine pre-push base branch detection and update plane test candidate paths ([b09a6c8](https://github.com/es6kr/skills/commit/b09a6c895113eaf698a12c79744261ec4c5c78d8))\n* **hook-kit:** resolve RAG receiver from workspace config instead of mandating --rag ([58e85ec](https://github.com/es6kr/skills/commit/58e85ecbb437557544cd528281aa30b804bd2532))\n\n## [0.9.1](https://github.com/es6kr/skills/compare/git-repo-v0.9.0...git-repo-v0.9.1) (2026-08-26)\n\n\n### Bug Fixes\n\n* accumulate 16 patch-level bug fixes and guard enhancements across skills ([d214e5d](https://github.com/es6kr/skills/commit/d214e5dcc7fac1bc07baf3b6cec62999aea732f0))\n* **git-repo:** add baseline .gitignore hygiene gate for worktrees and runtime artifacts ([32713d9](https://github.com/es6kr/skills/commit/32713d91e0e05936a78ea7df717b8fe87568269b))\n* **git-repo:** gate worktree reuse on dependency-install cost ([387653c](https://github.com/es6kr/skills/commit/387653c69e5a5172c37dc8f77261ae5ebc9013e7))\n* promote next-fix batch (consolidate fabrication guard, session rewind, config-driven PR base) ([7ca0ccb](https://github.com/es6kr/skills/commit/7ca0ccbf13cefafedc33a16a7361756c95f8b8f6))\n\n## [0.9.0](https://github.com/es6kr/skills/compare/git-repo-v0.8.1...git-repo-v0.9.0) (2026-08-20)\n\n\n### Features\n\n* promote next-feat staging (lifecycle guards, triage automation, and workflow safety procedures) ([77d58ac](https://github.com/es6kr/skills/commit/77d58ac3a771a4897043c9eea8b149ea1e8ba2ff))\n\n\n### Bug Fixes\n\n* **git-repo:** document conflict root-cause diagnosis (staleness vs divergence) ([f034168](https://github.com/es6kr/skills/commit/f0341685d6bf07c9d16e9375c93c22fea88b454f))\n* **git-repo:** document conflict root-cause diagnosis (staleness vs divergence) ([3f8e492](https://github.com/es6kr/skills/commit/3f8e4924bd8a656ea3fc1eeb573c9a629fea80cd))\n* promote next-fix batch (hook path repair, topic-dispatch scoping, conflict diagnosis) ([eb7ecb6](https://github.com/es6kr/skills/commit/eb7ecb61dda9701d78f12dc810781dc7cb687caa))\n\n## [0.8.1](https://github.com/es6kr/skills/compare/git-repo-v0.8.0...git-repo-v0.8.1) (2026-08-17)\n\n\n### Bug Fixes\n\n* **git-repo:** add worktree-ancestry divergence pre-check for staging-branch model ([d28bbdb](https://github.com/es6kr/skills/commit/d28bbdb29a76306d143c812bef6363afb5c66fea))\n* **git-repo:** let rename-worktree base a new branch somewhere other than stale HEAD ([98e9201](https://github.com/es6kr/skills/commit/98e92018b94a9b52bb2c585fdabf158c2347379a))\n* promote next-fix staging (30 fixes across 14 skills) ([ee467c0](https://github.com/es6kr/skills/commit/ee467c045d779d7b80d30f160763ec3534a9742b))\n* **wip:** cross-ref PR-URL and TaskCreate subject repo-qualifier rules ([#186](https://github.com/es6kr/skills/issues/186)) ([4982364](https://github.com/es6kr/skills/commit/49823641a7b08123ebd0325273892bee41bc3280))\n\n## [0.8.0](https://github.com/es6kr/skills/compare/git-repo-v0.7.2...git-repo-v0.8.0) (2026-08-16)\n\n\n### Features\n\n* merge next-feat into main ([#313](https://github.com/es6kr/skills/issues/313)) ([2d9308a](https://github.com/es6kr/skills/commit/2d9308ab3e7e0086a88a7f64d3ed4d5c4d36e017))\n\n## [0.7.2](https://github.com/es6kr/skills/compare/git-repo-v0.7.1...git-repo-v0.7.2) (2026-08-09)\n\n\n### Bug Fixes\n\n* **consolidate:** address CodeRabbit/Copilot review findings on PR [#270](https://github.com/es6kr/skills/issues/270) ([3b11a73](https://github.com/es6kr/skills/commit/3b11a730b5ad68803d35a8264eda540e48265d75))\n* **git-repo:** add worktree-reuse path-canonicality pre-check helper ([#267](https://github.com/es6kr/skills/issues/267)) ([020a94e](https://github.com/es6kr/skills/commit/020a94ee989596941c5669995a7f7ba340742313))\n* **git-repo:** preserve tracked mode in stage-isolated-content.sh cacheinfo ([#259](https://github.com/es6kr/skills/issues/259)) ([161f07d](https://github.com/es6kr/skills/commit/161f07d13bd19f17b190800062955d767e83bf04))\n* **git-repo:** validate worktree path canonicality before reuse ([#240](https://github.com/es6kr/skills/issues/240)) ([e44076b](https://github.com/es6kr/skills/commit/e44076bebe2e952bd042f0539b45322984cd3d72))\n* promote accumulated next-fix fixes to main ([95656e9](https://github.com/es6kr/skills/commit/95656e9b551ee0bb77904a0a571d49c53bc01cc9))\n\n## [0.7.1](https://github.com/es6kr/skills/compare/git-repo-v0.7.0...git-repo-v0.7.1) (2026-08-05)\n\n\n### Bug Fixes\n\n* promote next-fix staging (38 fixes across 16 skills) ([94f8c33](https://github.com/es6kr/skills/commit/94f8c33800ce411ae63e22c5259cdae8435508a4))\n\n## [0.7.0](https://github.com/es6kr/skills/compare/git-repo-v0.6.1...git-repo-v0.7.0) (2026-08-03)\n\n\n### Features\n\n* promote next-feat to main ([4fbe313](https://github.com/es6kr/skills/commit/4fbe31332c58bf24327d819cc9204ebda2d4afa8))\n\n\n### Bug Fixes\n\n* **git-repo:** add --push flag to local-to-staging-pr.sh ([#191](https://github.com/es6kr/skills/issues/191)) ([7eec556](https://github.com/es6kr/skills/commit/7eec556a6411352781de33121c42da0e186512b3))\n\n## [0.6.1](https://github.com/es6kr/skills/compare/git-repo-v0.6.0...git-repo-v0.6.1) (2026-07-28)\n\n\n### Bug Fixes\n\n* **git-repo:** add commit-worktree-cherry-pick-draft-PR section + resolve stray merge markers ([4417701](https://github.com/es6kr/skills/commit/44177013a9e7af8a49cff79e1f7c82436410645e))\n* **git-repo:** add commit-worktree-cherry-pick-draft-PR section + resolve stray merge markers ([9f2dc23](https://github.com/es6kr/skills/commit/9f2dc2351874fda79e9ef4fe7608f51a6a5c5d68))\n* **git-repo:** scope conflict-resolution to next-fix, add missing script ([a23f749](https://github.com/es6kr/skills/commit/a23f749bfbf8ad8702f887ed5e85c0bd6fdff860))\n* **next-fix:** promote staged fixes across hook-kit, next, cleanup, fix-plan ([34f1c67](https://github.com/es6kr/skills/commit/34f1c67beee3a8279e0e80de4ab3a87ba2223d5c))\n* resolve PR [#197](https://github.com/es6kr/skills/issues/197) review findings (CodeRabbit + Copilot + Internal Review) ([b54236a](https://github.com/es6kr/skills/commit/b54236a4fa4b3fef23645dfc3b184916980b7f65))\n\n## [0.6.0](https://github.com/es6kr/skills/compare/git-repo-v0.5.0...git-repo-v0.6.0) (2026-07-23)\n\n\n### Features\n\n* **consolidate:** address PR 134 reviews and reflect orange/yellow severity display rules ([e6118d0](https://github.com/es6kr/skills/commit/e6118d0fb0217a4c4ad388b82e574203a8f9258e))\n* **next-feat:** accumulate features for hook-kit context gate ([df4f73a](https://github.com/es6kr/skills/commit/df4f73ae4d27d4919105da70c6c94a14a32e8056))\n* skills topic bundle — brief/email, code-workflow/plan-research-search, git-repo topics, skill-kit/invoke-discipline ([7fd877d](https://github.com/es6kr/skills/commit/7fd877da1b703fcdcdcaf1a3ce912f885abfa3f0))\n\n## [0.5.0](https://github.com/es6kr/skills/compare/git-repo-v0.4.3...git-repo-v0.5.0) (2026-07-19)\n\n\n### Features\n\n* **git-repo,cleanup:** promote next-feat staging ([8ffeb4e](https://github.com/es6kr/skills/commit/8ffeb4e487e68ac034e349bf765fe144eae5d68d))\n* **git-repo:** add local-to-staging-pr.sh for the staging-PR flow ([#105](https://github.com/es6kr/skills/issues/105)) ([166d481](https://github.com/es6kr/skills/commit/166d481836a1812cb8b18cc6ed8d1870fb99cfbc))\n\n\n### Bug Fixes\n\n* **git-repo:** harden worktree checks against ls multi-arg false nega… ([#110](https://github.com/es6kr/skills/issues/110)) ([2c5f1e3](https://github.com/es6kr/skills/commit/2c5f1e3810b9cd67247d26d80e978aa84fd3e07a))\n* **pr111:** resolve 14 consolidated review findings ([38f8833](https://github.com/es6kr/skills/commit/38f88332f03ec3bc5085083ea155f093a536acf2))\n\n## [0.4.3](https://github.com/es6kr/skills/compare/git-repo-v0.4.2...git-repo-v0.4.3) (2026-07-16)\n\n\n### Bug Fixes\n\n* **consolidate,fix-plan:** promote next-fix staging (review hardening + periodic archive) ([24726e9](https://github.com/es6kr/skills/commit/24726e99a5b2972f706d8749ea3a45cbc358984b))\n* **git-repo:** gate worktree reuse on active operation state ([542f236](https://github.com/es6kr/skills/commit/542f2366682214fed869ec3f5776eb5017b114fb))\n\n\n### Documentation\n\n* add install-guide READMEs for consolidate, git-repo, skill-kit ([380db80](https://github.com/es6kr/skills/commit/380db8070a60dbfe1be29d940a6740e1119db748))\n* add install-guide READMEs for consolidate, git-repo, skill-kit ([d9bec4b](https://github.com/es6kr/skills/commit/d9bec4bb17c294a40c373c376a2f22aa0d3c04f2))\n* correct skills install command (add, not install) + superpowers namespace ([ed8fb1a](https://github.com/es6kr/skills/commit/ed8fb1ab2cd251e2395363948104bd3d3915f010))\n\n## [0.4.2](https://github.com/es6kr/skills/compare/git-repo-v0.4.1...git-repo-v0.4.2) (2026-06-25)\n\n\n### Bug Fixes\n\n* **fix:** split Step 2 medium by content type — case history to failed-attempts.md ([#62](https://github.com/es6kr/skills/issues/62)) ([747b3f9](https://github.com/es6kr/skills/commit/747b3f957ca0fefdbc5044eb08f66b8aafc1e26a))\n* **skills:** apply PR [#50](https://github.com/es6kr/skills/issues/50) Phase 2 follow-up reviews ([33863d7](https://github.com/es6kr/skills/commit/33863d705f8b24051b030b839487e8b5a8bfd9df))\n\n## [0.4.1](https://github.com/es6kr/skills/compare/git-repo-v0.4.0...git-repo-v0.4.1) (2026-06-19)\n\n\n### Bug Fixes\n\n* bundle skill patches across 7 scopes ([f18f47c](https://github.com/es6kr/skills/commit/f18f47c2d05f13b8e3f3ad42675a2dabbb31c824))\n* **git-repo:** clarify repo-to-bare-worktree index reset behavior ([1503dbf](https://github.com/es6kr/skills/commit/1503dbf29e9eb4269e892920772ab24024b358e3))\n* **git-repo:** note relative gitdir edge case in rename-worktree.sh ([3761f77](https://github.com/es6kr/skills/commit/3761f7714eb0de26be63bf03d634c4753ff12560))\n* **git-repo:** support bare-with-worktree layout in rename-worktree.sh ([3a2e261](https://github.com/es6kr/skills/commit/3a2e2618f3e85bcbeb500cfd023dccf9241cff7c))\n\n## [0.4.0](https://github.com/es6kr/skills/compare/git-repo-v0.3.2...git-repo-v0.4.0) (2026-06-12)\n\n\n### Features\n\n* decompose workflow/git rules + rename web-ui-test→web-browser ([#50](https://github.com/es6kr/skills/issues/50)) ([e10d48f](https://github.com/es6kr/skills/commit/e10d48fea4e507b95888de44812b53484d32128d))\n\n## [0.3.2](https://github.com/es6kr/skills/compare/git-repo-v0.3.1...git-repo-v0.3.2) (2026-06-07)\n\n\n### Bug Fixes\n\n* **git-repo,skill-kit:** pre-commit worktree matrix + external-system structure check ([7f05819](https://github.com/es6kr/skills/commit/7f058194fcf568b7cac57fd79788b20caf217ae5))\n* **git-repo,skill-kit:** strictyaml description block scalar ([#44](https://github.com/es6kr/skills/issues/44)) ([fe0da66](https://github.com/es6kr/skills/commit/fe0da66e80ee06e2e30190a4afc4c12363f0d51f))\n* **skill-git-repo:** add Pre-commit worktree matrix check section ([98b3f0f](https://github.com/es6kr/skills/commit/98b3f0f37dd2c92022ab8d739aacffbd5846589c))\n* **skill-kit,git-repo:** address PR [#46](https://github.com/es6kr/skills/issues/46) review findings 1-6 ([ba4592c](https://github.com/es6kr/skills/commit/ba4592c9209718bab7ba2af82f060f82a529f1e6))\n\n## [0.3.1](https://github.com/es6kr/skills/compare/git-repo-v0.3.0...git-repo-v0.3.1) (2026-06-03)\n\n\n### Documentation\n\n* **git-repo:** expand ssh-key HTTPS credential helper guidance ([07b189c](https://github.com/es6kr/skills/commit/07b189ce33b0f4c06c4275483bb1fd7041c65084))\n* **git-repo:** qualify Full Disk Access guidance as macOS-specific ([cfcc250](https://github.com/es6kr/skills/commit/cfcc2508092bb5d7609e8fea891572b094d6a916))\n\n## [0.3.0](https://github.com/es6kr/skills/compare/git-repo-v0.2.0...git-repo-v0.3.0) (2026-05-27)\n\n\n### Features\n\n* **git-repo:** add worktree management + multi-account SSH topics ([#26](https://github.com/es6kr/skills/issues/26)) ([3486eba](https://github.com/es6kr/skills/commit/3486eba3e1a670e57a672303b4d89ee20b0a7831))\n\n## [0.2.0](https://github.com/es6kr/skills/compare/git-repo-v0.1.2...git-repo-v0.2.0) (2026-05-24)\n\n\n### Features\n\n* **ci:** add lint jobs and untrack LICENSE ([#7](https://github.com/es6kr/skills/issues/7) Phase 1) ([03a8587](https://github.com/es6kr/skills/commit/03a85872c575c6ffdf72f5ca2bdb353fdc947a73))\n* publish 7 new skills, update 4 existing skills ([dce016d](https://github.com/es6kr/skills/commit/dce016da291f4c9da03746f8be668fa5db04e578))\n\n\n### Bug Fixes\n\n* address CodeRabbit review findings on PR [#4](https://github.com/es6kr/skills/issues/4) ([bbaefdc](https://github.com/es6kr/skills/commit/bbaefdc8a88f26b0b072e115d0696e732ac52e0c))\n\nFile v0.12.1:clone.md\n\n# ghq Clone\n\nWorkflow for automatically registering in SourceGit after `ghq get`.\n\n## When to Use\n\n- User runs `ghq get <url>`\n- User mentions \"ghq clone\", \"ghq get\", \"clone repository\"\n- Skill arguments contain URL (https:// or git@)\n\n## Workflow\n\n### Step 0: Pre-Clone Check (verify existing repository)\n\n**CRITICAL**: Check for existing repository before running ghq get\n\n#### 0-1. Check existing paths\n\nExtract repo name from URL and check related paths:\n\n```bash\n# 1. ghq default repository (ghq checks automatically - skip)\n# ~/ghq/host/group/repo\n\n# 2. Check bare repository (ghq does NOT check this!)\nls ~/ghq/host/group/repo.git 2>/dev/null\n\n# 3. Check existing worktree paths (paths registered in SourceGit)\n# ~/works/group/repo format\n```\n\n#### 0-1a. Handle broken clone remnants\n\nIf a directory with only an empty `.git` remains from a previously failed clone, `ghq get` will skip it as \"exists\":\n\n```bash\n# Detect broken repository\ncd ~/ghq/host/group/repo && git status 2>&1\n# → \"fatal: not a git repository\" → broken state\n\n# Move broken directory and re-clone\nmv ~/ghq/host/group/repo ~/.claude/.bak/repo_$(date +%Y%m%d)\n```\n\n#### 0-2. When bare repository exists\n\nIf a bare repository (`~/ghq/.../repo.git`) is found:\n\n1. **Check status**: Verify connected worktrees and changes\n2. **Convert if needed**: Can convert to regular repository using `migrate` topic\n\n#### 0-3. Check SourceGit registration path\n\nCheck if existing repository is registered in SourceGit:\n\n```bash\n# Search for repo name in preference.json\ngrep -l \"repo-name\" ~/Library/Application\\ Support/SourceGit/preference.json\n```\n\nIf a registered path is found:\n\n1. Check for changes at that path\n2. Check if `.git` is a file (recommend conversion if it's a worktree)\n\n### Step 1: Clone with ghq\n\nAfter pre-check passes:\n\n```bash\nghq get <url>\n```\n\nParse cloned path from output:\n\n- Extract path from `clone https://... -> /path/to/repo` format\n\n### Step 1.5: Repository `.gitignore` Hygiene Baseline Check\n\nVerify that the cloned repository has standard baseline ignores configured (or add to `.git/info/exclude` / `.gitignore`):\n\n- `.worktrees/` (Worktree isolation)\n- `.DS_Store` (OS junk)\n- `__pycache__/` (Python bytecode cache)\n- `*.bak` (Local backup files)\n- `*.tmp` (Temporary files)\n\n```bash\n# Verify baseline ignore patterns\ncd /path/to/repo\ngrep -q \"^\\.worktrees/\" .gitignore 2>/dev/null || echo -e \"\\n# Worktrees & Runtime\\n.worktrees/\\n.DS_Store\\n__pycache__/\\n*.bak\\n*.tmp\" >> .gitignore\n```\n\n### Step 2: Parse Repository Info\n\nExtract host/group/repo from URL:\n\n- `https://github.com/org/repo.git`\n  - Host: `github.com`\n  - Group: `org`\n  - Repo: `repo`\n\n### Step 3: Check SourceGit Status\n\n```bash\npgrep -x SourceGit\n```\n\n- **Running**: **Skip** SourceGit registration and report clone path only. When SourceGit exits, it overwrites preference.json on disk with its in-memory version, so edits made while running will be lost.\n- **Not running**: Proceed with registration\n\n### Step 4: Read preference.json\n\n```bash\ncat ~/Library/Application\\ Support/SourceGit/preference.json\n```\n\n### Step 5: Find or Create Group\n\nFind group in RepositoryNodes:\n\n1. Search by group name (e.g., `org-name`)\n2. If not found, create new group:\n\n```json\n{\n  \"Id\": \"uuid-v4\",\n  \"Name\": \"org-name\",\n  \"Bookmark\": 0,\n  \"IsRepository\": false,\n  \"IsExpanded\": true,\n  \"Status\": null,\n  \"SubNodes\": []\n}\n```\n\n### Step 6: Add Repository to Group\n\nAdd to the group's SubNodes:\n\n```json\n{\n  \"Id\": \"/Users/user/ghq/github.com/org/repo\",\n  \"Name\": \"repo\",\n  \"Bookmark\": 0,\n  \"IsRepository\": true,\n  \"IsExpanded\": false,\n  \"Status\": null,\n  \"SubNodes\": []\n}\n```\n\n### Step 7: Save and Report\n\nEdit preference.json with Edit tool and report result:\n\n```\nClone and SourceGit registration complete:\n- Path: ~/ghq/github.com/org/repo\n- Group: org\n\nWill be reflected when SourceGit is restarted.\n```\n\n## Group Naming Strategy\n\n| URL Host    | Group Name                          |\n| ----------- | ----------------------------------- |\n| github.com  | github.com > org hierarchy          |\n| Other       | host > group hierarchy              |\n\n## GitHub Multi-Account Clone\n\nWhen `gh auth switch` bug prevents active account switching, specify `GH_TOKEN` directly for cloning:\n\n```bash\n# 1. Clone with target account's token\nTOKEN=$(gh auth token --user <GITHUB_USER> 2>/dev/null)\ngit clone \"https://<GITHUB_USER>:${TOKEN}@github.com/org/repo.git\" ~/ghq/github.com/org/repo\n\n# 2. Always remove token from origin after cloning\ngit -C ~/ghq/github.com/org/repo remote set-url origin \"https://github.com/org/repo.git\"\n```\n\n**gh auth switch bug detection**:\n```bash\ngh auth switch --user <GITHUB_USER> 2>&1  # \"Switched\" message output\ngh api user --jq '.login'                  # still shows other user → bug\n```\n\nIn this case, `ghq get` uses the default account token and fails. Use `git clone` + direct `GH_TOKEN` instead.\n\n## No Questions Asked\n\n**Important**: This workflow proceeds automatically without user confirmation.\n\n- ghq get succeeds → SourceGit registration (only when SourceGit is not running)\n- Group doesn't exist → auto-create\n- **SourceGit is running → skip registration** (in-memory content overwrites disk on exit)\n\nFile v0.12.1:conflict-dry-run.md\n\n# Conflict Dry-Run\n\nTest whether a merge or cherry-pick would apply cleanly, without touching the (possibly dirty) main working tree.\n\n## When to Use\n\n- Verifying a commit will cherry-pick cleanly onto another branch before actually doing it\n- Checking whether two branches (e.g. a staging branch and `main`) would conflict before opening a promotion PR\n- Any dry-run test where the main working tree has uncommitted changes you must not disturb\n\n## Why Not the Main Working Tree\n\nRunning `git checkout -b <tmp> <ref>` or `git merge --no-commit` directly in the main working tree risks:\n\n- Colliding with uncommitted changes already present (the dry-run's changed files may overlap with real in-progress edits)\n- Leaving the repo in a half-merged/half-checked-out state if the test is interrupted\n- Requiring careful cleanup (`git merge --abort`, checkout back) that itself competes with concurrent work in the same tree\n\nAn isolated worktree sidesteps all of this — it has its own working tree and index, entirely separate from the main one.\n\n## Procedure\n\n### 1. Create a detached worktree from the bare mirror\n\nUse the bare mirror (`ghq`-style bare clone), not the main working tree, as the source:\n\n```bash\nBARE=/path/to/ghq/github.com/<org>/<repo>.git   # or any bare/mirror remote of the repo\nSCRATCH=/tmp/conflict-check                      # any scratch location, session-specific\n\ngit -C \"$BARE\" worktree add --detach \"$SCRATCH\" origin/<base-ref>\n```\n\n`--detach` avoids the \"branch already checked out elsewhere\" error when the branch under test is also checked out in another active worktree.\n\n### 2. Run the test\n\n**Cherry-pick applicability**:\n\n```bash\ncd \"$SCRATCH\"\ngit cherry-pick --no-commit <sha>\ngit status --short          # staged M/A with no U (unmerged) = clean\ngit diff --stat              # confirm expected file set\n```\n\n**Merge cleanliness** (e.g. would branch A merge cleanly into branch B):\n\n```bash\ncd \"$SCRATCH\"\ngit merge origin/<other-branch> --no-commit --no-ff\ngit diff --name-only --diff-filter=U | wc -l   # 0 = clean, N>0 = N conflicting files\n```\n\n### 3. Clean up\n\n```bash\ncd \"$SCRATCH\"\ngit merge --abort 2>/dev/null || git reset --hard   # discard the dry-run state\ncd \"$BARE\"\ngit worktree remove --force \"$SCRATCH\"\n```\n\nIf a safety hook blocks `git merge --abort` (treating it as \"discarding in-progress conflict resolution\"), it is safe to leave the disposable scratch worktree as-is rather than force through the guard — it does not affect the main working tree or any shared branch.\n\n## Don't / Do\n\n| # | Don't | Do |\n|---|-------|-----|\n| 1 | `git checkout -b <tmp>` in the main working tree to test a merge/cherry-pick | `git worktree add --detach <bare> <ref>` — isolated, no risk to uncommitted work |\n| 2 | Trust `git merge-tree <base> <a> <b>` (legacy 2-tree form) with the wrong base argument (e.g. passing one of the branches itself as base) | Compute the actual merge-base first (`git merge-base <a> <b>`) and pass that, or just do a real `git merge --no-commit` in an isolated worktree — it's authoritative where `merge-tree` misuse is not |\n| 3 | Interpret a platform's `mergeable: false` / `mergeable_state: \"dirty\"` API field as possibly stale without checking | Reproduce locally via this dry-run procedure before concluding the platform's mergeability computation is wrong |\n| 4 | Leave the scratch worktree registered after the test | Remove it (`git worktree remove --force`) unless a safety hook blocks the abort step — in that case leaving it is harmless (see Step 3) |\n| 5 | With `git merge-tree --write-tree <branch1> <branch2>` (no explicit base), read the printed unmerged stages by intuition | Stage numbers are fixed regardless of which side \"looks like\" base: **1 = merge-base, 2 = branch1 (ours), 3 = branch2 (theirs)**. Mislabeling these inverts which side's content you think is which — verify by diffing each stage's blob against the actual ref tips, don't assume from context |\n\n## Diagnosing why a conflict exists (base staleness vs. genuine divergence)\n\nA conflict against an accumulation branch has two structurally different causes that call for different fixes:\n\n- **Base staleness**: the target base is behind another branch it should track — switching base or rebasing resolves it trivially\n- **Genuine parallel divergence**: an equivalent fix already landed on the target via a different commit, so the conflicting commit's content is now partially or fully redundant — switching base changes nothing (the same conflict reproduces against any branch containing that equivalent fix)\n\nBefore assuming staleness, check whether the conflict is redundant, not just stale:\n\n```bash\n# Does the target already contain equivalent content for the touched files?\ngit diff origin/<candidate-base-A> origin/<candidate-base-B> -- <touched-paths>   # empty = both bases identical here, switching base won't help\n\n# Is the conflicting commit's content already upstream (a \"straggler\")?\ngit cherry -v origin/<base> <branch>   # '-' prefix = already upstream (delta 0), '+' = real delta\n```\n\n`git cherry -v` showing `+` (real delta) does not rule out redundancy at the *file* level — a commit can carry one hunk that's genuinely new and another that's fully superseded by a separate, already-merged commit. When that's the case, resolving via `git rebase <target>` and taking the target's version for the superseded hunk often makes the redundant sub-commit collapse to empty (git drops it automatically) while the genuinely new content survives untouched — a cleaner outcome than manually splicing the two versions.\n\n## Related\n\n- [worktree.md](./worktree.md) — general worktree inventory/reuse/create workflow (for actual work, not dry-run testing)\n\nFile v0.12.1:credential-helper.md\n\n# Credential Helper (HTTPS multi-account)\n\nPin a per-org GitHub token for HTTPS remotes so the **active `gh` account** never decides which credential a private-org repo gets. The HTTPS counterpart to the SSH-focused `ssh-key` topic.\n\n## When to Use\n\n- Multiple GitHub accounts authenticated in `gh` (`gh auth status` shows 2+ accounts)\n- A private org repo intermittently fails with `remote: Repository not found` over **HTTPS** — typically right after working on a different org whose account became active\n- The failure \"fixes itself\" when you switch `gh` accounts, then returns later\n- SourceGit / other GUI clients hit the same `Repository not found` because they call git's HTTPS credential pipeline directly\n\nIf the remote is SSH (`git@github.com:...`), use the `ssh-key` topic instead.\n\n## Root Cause\n\nWhen the global gitconfig routes GitHub HTTPS auth through `gh`:\n\n```\n[credential \"https://github.com\"]\n    helper = !gh auth git-credential\n```\n\n`gh auth git-credential` returns the token of the **currently active** `gh` account. If the active account lacks access to a private repo, GitHub returns `404` for the repo, which git surfaces as:\n\n```\nremote: Repository not found.\nfatal: repository 'https://github.com/<org>/<repo>.git/' not found\n```\n\nThe repo exists and the *correct* account has access — but the *active* account doesn't, so it reads as \"not found\" (GitHub returns 404, not 403, for private repos you can't see). Because the active account flips as you move between orgs, the breakage is recurring rather than permanent.\n\n| # | Don't | Do |\n|---|-------|-----|\n| 1 | Read `Repository not found` as \"the repo was deleted/renamed\" | Verify existence + access with the right account first (`gh repo view <org>/<repo> --json isPrivate`) before assuming the repo is gone |\n| 2 | Fix it by `gh auth switch` each time | Switching is temporary — it breaks again when the active account flips. Pin the account per-org (Solution below) |\n| 3 | Assume the credential helper is `manager`/GCM because `git config credential.helper` says so | A path-specific `credential.https://github.com.helper` overrides the generic helper. Check `git config --global --get-regexp 'credential.*github'` for the helper that actually runs |\n\n## Diagnosis\n\n```bash\nREPO=<path-to-repo>\n\n# 1. Which gh accounts exist, and which is active?\ngh auth status\n\n# 2. Reproduce the failure on the actual auth path (no interactive prompt)\nGIT_TERMINAL_PROMPT=0 git -C \"$REPO\" ls-remote origin -h 2>&1 | head -3\n#    → \"remote: Repository not found.\" confirms the active-account mismatch\n\n# 3. Confirm the repo exists + which account has access\ngh auth switch --user <account-with-access>\ngh repo view <org>/<repo> --json name,isPrivate     # succeeds → access OK\nGIT_TERMINAL_PROMPT=0 git -C \"$REPO\" ls-remote origin -h ; echo \"exit=$?\"   # exit=0 → access OK\n\n# 4. Inspect the helper that actually runs for github.com\ngit config --global --get-regexp 'credential.*github'\n```\n\nIf step 2 fails with the active account but step 3 succeeds after switching, the diagnosis is confirmed: **HTTPS auth is bound to the active account**.\n\n## Solution — org-scoped credential helper\n\nAdd a credential helper **scoped to the org path** that always emits the correct account's token, independent of the active `gh` account:\n\n```bash\n# Back up first (gitconfig is a user file)\ncp ~/.gitconfig ~/.gitconfig.bak\n\n# Empty value resets inherited helpers for this path, then add the pinned one\ngit config --global credential.https://github.com/<org>.helper \"\"\ngit config --global --add credential.https://github.com/<org>.helper \\\n  '!f() { echo username=<account>; echo \"password=$(gh auth token --user <account>)\"; }; f'\n```\n\nResulting config block:\n\n```\n[credential \"https://github.com/<org>\"]\n    helper =\n    helper = !f() { echo username=<account>; echo \"password=$(gh auth token --user <account>)\"; }; f\n```\n\nHow it works:\n\n- `credential.https://github.com/<org>` matches only URLs under that org → other orgs are untouched\n- The empty `helper =` **resets** the helper list accumulated from the broader `https://github.com` scope, so the generic active-account helper is not also consulted for this org\n- `gh auth token --user <account>` returns that specific account's token regardless of which account is active\n- Works for git CLI **and** GUI clients (SourceGit etc.), since they all call git's HTTPS credential pipeline\n\n| # | Don't | Do |\n|---|-------|-----|\n| 1 | Set it per-repo (`git config` without `--global`) and re-do it on every clone | Scope to the org path in global config — every current and future repo under `<org>` inherits it |\n| 2 | Omit the empty `helper =` reset | Without the reset, both the pinned helper and the generic active-account helper run; the active-account one can still win and re-break auth |\n| 3 | Hardcode the token into the helper | Use `gh auth token --user <account>` so the token rotates with `gh` and is never written to disk |\n| 4 | Edit `~/.gitconfig` blind | `cp ~/.gitconfig ~/.gitconfig.bak` first — it is a user-owned file |\n\n## Verification (HARD STOP — GUI client too)\n\nCLI passing alone is insufficient. The recurring failure was originally reported in a GUI client, so verify there.\n\n```bash\n# CLI: with the WRONG account still active, the org repo must now succeed\ngh auth switch --user <other-account>          # simulate the breaking condition\nGIT_TERMINAL_PROMPT=0 git -C \"$REPO\" ls-remote origin -h ; echo \"exit=$?\"   # expect exit=0\n\n# Regression: a repo under a DIFFERENT org must still use its own account\nGIT_TERMINAL_PROMPT=0 git -C <other-org-repo> ls-remote origin -h >/dev/null 2>&1 && echo \"no regression\"\n```\n\n| Verification | Action |\n|--------------|--------|\n| CLI (active = wrong account) | `git ls-remote origin` from the repo → exit 0, no `Repository not found` |\n| Other-org regression | `git ls-remote` on a repo under a different org → still succeeds with its own account |\n| **SourceGit** | Open the repo → **Fetch** → must succeed without `Repository not found` |\n| Other GUI (GitHub Desktop, etc.) | Fetch origin → confirm success |\n\n**Do not declare \"fix complete\" until the user's GUI client (the one that reported the failure) succeeds.** CLI green + GUI red = same root issue still active.\n\n## Notes\n\n- Global org-scoped config covers all repos under `<org>` — no per-clone re-application (unlike per-repo SSH `core.sshCommand`)\n- This is HTTPS-only. For SSH remotes with the same multi-account problem, see the `ssh-key` topic\n- The org → account mapping is the user's to decide; this topic only pins whatever mapping is given\n- `gh auth token --user <account>` requires that account to be logged in (`gh auth login`) at least once\n\nFile v0.12.1:doctor.md\n\n# Git Repository & Hook Doctor\n\nComprehensive health check and diagnosis for Git repository hooks across universal (Tier 1 Base) and context-specific (Tier 2 Conditional) standards.\n\n## When to Use\n\n- Repository pre-push or pre-commit checks fail unexpectedly or are bypassed\n- New repository onboarding or repository hooks audit (`.githooks` vs `core.hooksPath`)\n- Branch deletion wastes heavy CI resources in `pre-push`\n- Staging and pushing private branches (e.g. `refs/heads/local`) needs protection\n- Audit public repositories for secret/Korean text leakage or corporate repositories for direct `main` push protection\n- A merge commit's message still shows a leftover `# Conflicts:` block (produced by `git merge --no-edit` or another non-interactive commit path after resolving conflicts)\n- User mentions: \"repo doctor\", \"hook health\", \"diagnose hooks\", \"check hooks\", \"hook wiring\", \"zero-SHA pre-push\", \"doctor\", \"Conflicts:\", \"conflict marker in commit message\"\n\n---\n\n## 2-Tier Diagnostic Taxonomy\n\n```mermaid\ngraph TD\n    A[git-repo doctor] --> B[Tier 1: Base Universal Checks]\n    A --> C[Tier 2: Conditional Checks]\n    \n    B --> B1[BASE-1: Hook Wiring]\n    B --> B2[BASE-2: File Permissions]\n    B --> B3[BASE-3: Zero-SHA Pre-push Exit]\n    B --> B4[BASE-4: Local Branch Guard]\n    B --> B5[BASE-5: Secret & IP Guard]\n    B --> B6[BASE-6: Push Commit Limit Guard]\n    B --> B7[BASE-7: Conflict Marker Guard]\n    \n    C --> C1[COND-MD: Markdown Lint]\n    C --> C1S[COND-MD-STYLE: Markdown Style Lint]\n    C --> C2[COND-SKILL: Skill Frontmatter]\n    C --> C3[COND-AGENT: Tracker Guard]\n    C --> C4[COND-GO: Go Toolchain Lint]\n    C --> C5[COND-PUBLIC: English Hangul Gate]\n    C --> C6[COND-CORP: Main Branch Push Block]\n    C --> C7[COND-HOOK-REG: Hook Registration Integrity]\n```\n\n### Tier 1: Base (Universal) Checks\n\n| ID | Category | Target | Rule & Failure Condition |\n| :--- | :--- | :--- | :--- |\n| **`BASE-1`** | **Hook Wiring** | `.githooks` vs `core.hooksPath` | If `.githooks/` directory exists, `core.hooksPath` MUST point to `.githooks`. Otherwise Git reads default `.git/hooks` and `.githooks/` is completely unwired/ignored. |\n| **`BASE-2`** | **Permissions** | Executable bit (`+x`) | Active hook files (`pre-commit`, `pre-push`, `commit-msg`, etc.) must have executable bits (`chmod +x`). |\n| **`BASE-3`** | **Pre-push Deletion** | Zero-SHA early exit | `pre-push` hook must detect remote branch deletion (`local_sha=0000...0000`, `local_ref=(delete)`, or `remote_sha=0000...0000`) and skip heavy CI tests immediately. |\n| **`BASE-4`** | **Local Branch Guard** | `local` / private branch guard | `pre-push` hook must contain a guard blocking accidental push of private staging branches (`refs/heads/local*`, `wip*`, `scratch*`) to remote. |\n| **`BASE-5`** | **Secret & IP Guard** | Secret / IP scan | `pre-commit` hook must scan staged files for private RFC1918 IPs (`10.x`, `192.168.x`, `172.16-31.x`) and home paths. |\n| **`BASE-6`** | **Push Commit Limit Guard** | Outgoing commit count check | `pre-push` hook must check outgoing commit count (`rev-list --count` / `PUSH_MAX_COMMITS`) and block pushes exceeding the limit (default: 5) to prevent publishing massively diverged commits caused by wrong base branch selection. Override via `PUSH_COMMIT_LIMIT_OVERRIDE=1`. |\n| **`BASE-7`** | **Conflict Marker Guard** | Outgoing commit message scan | `pre-push` hook must scan each outgoing commit's message for a literal `Conflicts:` section (the auto-generated merge-conflict listing that `git merge --no-edit`, or any non-interactive commit path, leaves un-stripped) and block the push. Override via `PUSH_CONFLICT_MSG_OVERRIDE=1`. |\n\n### Tier 2: Conditional Checks\n\n| ID | Trigger Condition | Category | Requirement |\n| :--- | :--- | :--- | :--- |\n| **`COND-MD`** | Repository contains `*.md` | **Markdown Lint** | `pre-commit` or `pre-push` must contain markdown/hangul or link reference validator. |\n| **`COND-MD-STYLE`** | Repository contains `*.md` | **Markdown Style Lint** | A markdown style/whitespace linter (`markdownlint`, `remark-lint`, `mdl`, or `prettier --check` on `*.md`) declared in a `Makefile`, `package.json`, or `scripts/` must be invoked from `pre-commit`, `pre-push`, or CI. Distinct from `COND-MD`: frontmatter and hangul checks do not catch trailing whitespace or style drift, so a repository can pass `COND-MD` while having no style lint at all. WARN when no tooling manifest is pres\n\nArchive v0.12.0: 39 files, 113153 bytes\n\nFiles: CHANGELOG.md (16155b), clone.md (5209b), conflict-dry-run.md (5735b), credential-helper.md (6730b), doctor.md (12641b), fix-worktree.md (2263b), githooks.md (6504b), isolate-hunk.md (4551b), LICENSE (1063b), merge-duplicate.md (2710b), migrate.md (459b), move-worktree.md (5485b), patrol.md (6071b), README.md (597b), rebase-audit.md (10992b), rename-worktree.md (9791b), safe-relocate.md (2570b), scripts/check-worktree-canonical.sh (6008b), scripts/git-fix-worktree.sh (2513b), scripts/git-repo-doctor.sh (16911b), scripts/local-to-staging-pr.sh (8829b), scripts/prune_merged_worktrees.py (15175b), scripts/rename-worktree.sh (6840b), scripts/repo-to-bare-worktree.sh (5118b), scripts/repo-to-ghq.sh (7470b), scripts/stage-isolated-content.sh (2441b), skill-card.md (2637b), SKILL.md (17258b), sourcegit.md (5456b), ssh-key.md (5244b), tests/test_prune_merged_worktrees.py (8267b), tests/test-check-worktree-canonical.sh (3791b), tests/test-git-repo-doctor.sh (16480b), to-bare.md (4235b), to-ghq.md (6532b), worktree-drift-sync.md (3736b), worktree-register.md (4216b), worktree.md (38652b), _meta.json (128b)\n\nArchive v0.11.1: 37 files, 105312 bytes\n\nFiles: CHANGELOG.md (14999b), clone.md (5209b), conflict-dry-run.md (5735b), credential-helper.md (6730b), doctor.md (12641b), fix-worktree.md (2263b), githooks.md (6504b), isolate-hunk.md (4551b), LICENSE (1063b), merge-duplicate.md (2710b), migrate.md (459b), move-worktree.md (5485b), patrol.md (6071b), README.md (597b), rebase-audit.md (10992b), rename-worktree.md (9791b), safe-relocate.md (2570b), scripts/check-worktree-canonical.sh (6008b), scripts/git-fix-worktree.sh (2513b), scripts/git-repo-doctor.sh (16911b), scripts/local-to-staging-pr.sh (8829b), scripts/rename-worktree.sh (6840b), scripts/repo-to-bare-worktree.sh (5118b), scripts/repo-to-ghq.sh (7470b), scripts/stage-isolated-content.sh (2441b), skill-card.md (2429b), SKILL.md (16464b), sourcegit.md (5456b), ssh-key.md (5244b), tests/test-check-worktree-canonical.sh (3791b), tests/test-git-repo-doctor.sh (16480b), to-bare.md (4235b), to-ghq.md (6532b), worktree-drift-sync.md (3736b), worktree-register.md (4216b), worktree.md (38652b), _meta.json (128b)\n\nArchive v0.11.0: 37 files, 103955 bytes\n\nFiles: CHANGELOG.md (14443b), clone.md (5209b), conflict-dry-run.md (5735b), credential-helper.md (6730b), doctor.md (12641b), fix-worktree.md (2263b), githooks.md (6504b), isolate-hunk.md (4551b), LICENSE (1063b), merge-duplicate.md (2710b), migrate.md (459b), move-worktree.md (5485b), patrol.md (6071b), README.md (597b), rebase-audit.md (10992b), rename-worktree.md (9791b), safe-relocate.md (2570b), scripts/check-worktree-canonical.sh (6008b), scripts/git-fix-worktree.sh (2513b), scripts/git-repo-doctor.sh (16148b), scripts/local-to-staging-pr.sh (8829b), scripts/rename-worktree.sh (6840b), scripts/repo-to-bare-worktree.sh (5118b), scripts/repo-to-ghq.sh (7470b), scripts/stage-isolated-content.sh (2441b), skill-card.md (2634b), SKILL.md (16464b), sourcegit.md (5456b), ssh-key.md (5244b), tests/test-check-worktree-canonical.sh (3791b), tests/test-git-repo-doctor.sh (14389b), to-bare.md (4235b), to-ghq.md (6532b), worktree-drift-sync.md (3736b), worktree-register.md (4216b), worktree.md (38652b), _meta.json (128b)\n\nArchive v0.10.1: 37 files, 103673 bytes\n\nFiles: CHANGELOG.md (14143b), clone.md (5209b), conflict-dry-run.md (5735b), credential-helper.md (6730b), doctor.md (12182b), fix-worktree.md (2263b), githooks.md (6504b), isolate-hunk.md (4551b), LICENSE (1063b), merge-duplicate.md (2710b), migrate.md (459b), move-worktree.md (5485b), patrol.md (6071b), README.md (597b), rebase-audit.md (10992b), rename-worktree.md (9791b), safe-relocate.md (2570b), scripts/check-worktree-canonical.sh (6008b), scripts/git-fix-worktree.sh (2513b), scripts/git-repo-doctor.sh (15986b), scripts/local-to-staging-pr.sh (8829b), scripts/rename-worktree.sh (6840b), scripts/repo-to-bare-worktree.sh (5118b), scripts/repo-to-ghq.sh (7470b), scripts/stage-isolated-content.sh (2441b), skill-card.md (2600b), SKILL.md (16464b), sourcegit.md (5456b), ssh-key.md (5244b), tests/test-check-worktree-canonical.sh (3791b), tests/test-git-repo-doctor.sh (14389b), to-bare.md (4235b), to-ghq.md (6532b), worktree-drift-sync.md (3736b), worktree-register.md (4216b), worktree.md (38652b), _meta.json (128b)\n\nArchive v0.10.0: 37 files, 97985 bytes\n\nFiles: CHANGELOG.md (13358b), clone.md (5209b), conflict-dry-run.md (5735b), credential-helper.md (6730b), doctor.md (9001b), fix-worktree.md (2263b), githooks.md (6504b), isolate-hunk.md (4551b), LICENSE (1063b), merge-duplicate.md (2710b), migrate.md (459b), move-worktree.md (5485b), patrol.md (6071b), README.md (597b), rebase-audit.md (5518b), rename-worktree.md (9177b), safe-relocate.md (2570b), scripts/check-worktree-canonical.sh (6008b), scripts/git-fix-worktree.sh (2513b), scripts/git-repo-doctor.sh (12451b), scripts/local-to-staging-pr.sh (8829b), scripts/rename-worktree.sh (6840b), scripts/repo-to-bare-worktree.sh (5118b), scripts/repo-to-ghq.sh (7470b), scripts/stage-isolated-content.sh (2441b), skill-card.md (2364b), SKILL.md (16464b), sourcegit.md (5456b), ssh-key.md (5244b), tests/test-check-worktree-canonical.sh (3791b), tests/test-git-repo-doctor.sh (7959b), to-bare.md (4235b), to-ghq.md (6532b), worktree-drift-sync.md (3736b), worktree-register.md (4216b), worktree.md (38652b), _meta.json (128b)\n\nArchive v0.9.1: 34 files, 87281 bytes\n\nFiles: CHANGELOG.md (12057b), clone.md (5209b), conflict-dry-run.md (5735b), credential-helper.md (6730b), fix-worktree.md (2069b), githooks.md (6504b), isolate-hunk.md (4551b), LICENSE (1063b), merge-duplicate.md (2710b), migrate.md (459b), move-worktree.md (4446b), patrol.md (6071b), README.md (597b), rebase-audit.md (5518b), rename-worktree.md (9177b), safe-relocate.md (2570b), scripts/check-worktree-canonical.sh (6008b), scripts/git-fix-worktree.sh (2513b), scripts/local-to-staging-pr.sh (8829b), scripts/rename-worktree.sh (6840b), scripts/repo-to-bare-worktree.sh (5118b), scripts/repo-to-ghq.sh (7470b), scripts/stage-isolated-content.sh (2441b), skill-card.md (2397b), SKILL.md (16108b), sourcegit.md (5456b), ssh-key.md (5244b), tests/test-check-worktree-canonical.sh (3791b), to-bare.md (4235b), to-ghq.md (6532b), worktree-d...","readmeExcerpt":"Skill: git-repo Owner: drumrobot Summary: Git repository and SourceGit integration. Topics — clone (ghq), conflict-dry-run (isolated merge test), credential-helper (multi-account HTTPS token), doctor (hook health & compliance audit — Tier 1 Base + Tier 2 Conditional taxonomy), fix-worktree (bare repo recovery), githooks (hook silently never runs — hooksPath precedence, passthrough chain, install trade-off), isolate-h","codeSnippets":[],"executableExamples":[{"language":"text","snippet":"worktree (entry point — inventory + decision)\n  └─→ rename-worktree (reuse registered worktree)\n  └─→ move-worktree (register unregistered or relocate)\n\nworktree-register (shared metadata register/relink mechanism)\n  ├─← fix-worktree (recover a broken bare-worktree link)\n  └─← to-bare (link the working tree after a regular→bare conversion)\n\nto-bare  ←inverse→  to-ghq (formerly `migrate`)\n\nssh-key (SSH multi-account)  ──counterpart──  credential-helper (HTTPS multi-account)\n\nrebase-audit (active-rebase revert detection)  ──restoration mechanism shared with──  isolate-hunk (targeted hunk staging)"},{"language":"bash","snippet":"gitdir=$(git -C <W> rev-parse --absolute-git-dir)\n   ls \"$gitdir\"/CHERRY_PICK_HEAD \"$gitdir\"/MERGE_HEAD \"$gitdir\"/REBASE_HEAD \"$gitdir\"/BISECT_LOG \"$gitdir\"/rebase-merge \"$gitdir\"/rebase-apply 2>/dev/null\n   git -C <W> status --porcelain | grep -E '^(DD|AU|UD|UA|DU|AA|UU)'   # unmerged index entries"},{"language":"bash","snippet":"B=$(git -C <worktree> branch --show-current)\n   gh pr list --head \"$B\" --state all --json number,state,mergedAt --jq '.[0]'"},{"language":"text","snippet":"git status (check for other changes)\n  ├─ 0 other changes, branch = PR/feature → commit in place\n  ├─ 0 other changes, branch = main/master/develop\n  │    → AskUserQuestion: (a) create PR branch from current (b) create PR branch in a new worktree\n  ├─ 1+ other changes, branch = main/master/develop\n  │    → worktree split required. Leave other changes in place, isolate new work in a new worktree\n  └─ Another task running on a PR branch with stray changes on main\n       → Report to the user (confirm intent of stray changes) → decide worktree split + stray cleanup"},{"language":"bash","snippet":"npx skills add es6kr/skills --skill git-repo"},{"language":"bash","snippet":"npx skills add es6kr/skills --skill commit-tidy"}],"parameters":null,"dependencies":[],"permissions":[],"extractedFiles":[{"path":"SKILL.md","content":"---\nname: git-repo\nmetadata:\n  author: es6kr\n  version: \"0.1.2\"\ndepends-on:\n  - commit-tidy\ndescription: |\n  Git repository and SourceGit integration. Topics — clone (ghq), conflict-dry-run (isolated merge test), credential-helper (multi-account HTTPS token), doctor (hook health & compliance audit — Tier 1 Base + Tier 2 Conditional taxonomy), fix-worktree (bare repo recovery), githooks (hook silently never runs — hooksPath precedence, passthrough chain, install trade-off), isolate-hunk (stage own edit amid unrelated content), merge-duplicate, rebase-audit (accidental-revert detection during an active rebase), to-ghq (formerly migrate), to-bare, worktree-register (metadata register/relink), patrol (batch inspect), move-worktree (register/reclaim merged PR), rename-worktree, safe-relocate (relocate commits onto a clean base branch), sourcegit, ssh-key (multi-account SSH map), worktree (inventory + reuse + create), worktree-drift-sync (mirror fix across worktrees safely). Use when: \"reuse worktree\", \"multi-account clone\", \"Repository not found\", \"wrong account\", \"concurrent uncommitted edit\", \"accidental revert\", \"githooks ignored\", \"hook not running\", \"core.hooksPath\", \"hook not firing\", \"repo doctor\", \"hook health\", \"diagnose hooks\", \"check hooks\" triggers.\nallowed-tools:\n  - Read\n  - Edit\n  - Write\n  - Bash(ghq:*)\n  - Bash(git:*)\n  - Bash(mv:*)\n  - Bash(ls:*)\n  - Bash(pgrep:*)\n  - Bash(cat:*)\n---\n\n# Git Repo\n\nGit repository management and SourceGit GUI client integration.\n\n## Topics\n\n| Topic | Description | Guide |\n|-------|-------------|-------|\n| clone | ghq get with automatic SourceGit registration (multi-account support) | [clone.md](./clone.md) |\n| conflict-dry-run | test merge/cherry-pick applicability in an isolated worktree, without touching the main working tree | [conflict-dry-run.md](./conflict-dry-run.md) |\n| credential-helper | pin a per-org GitHub token for HTTPS remotes (fixes recurring `Repository not found` from active-account mismatch); HTTPS counterpart to ssh-key | [credential-helper.md](./credential-helper.md) |\n| doctor | diagnose Git repository hook health, wiring, permissions, and CI compliance (Base universal + Conditional domain/type taxonomy; helper: `scripts/git-repo-doctor.sh`) | [doctor.md](./doctor.md) |\n| fix-worktree | bare repo worktree configuration recovery | [fix-worktree.md](./fix-worktree.md) |\n| githooks | diagnose a `.githooks/` hook that silently never runs (hooksPath precedence, passthrough chains, execute bit) and choose an install method that keeps machine-wide hooks | [githooks.md](./githooks.md) |\n| isolate-hunk | stage only your own edit when a tracked file's working tree mixes it with unrelated uncommitted content, via git plumbing (no working-tree changes) | [isolate-hunk.md](./isolate-hunk.md) |\n| merge-duplicate | merge duplicate repositories with the same origin | [merge-duplicate.md](./merge-duplicate.md) |\n| migrate | **renamed → to-ghq** (backward-compat alias) | [migrate.md](./migrate.md) |"},{"path":"README.md","content":"# git-repo\n\nGit repository and worktree management with SourceGit integration — clone via ghq, inventory/reuse/create worktrees, convert repos to bare, and handle multi-account SSH and credentials.\n\n## Installation\n\n```bash\nnpx skills add es6kr/skills --skill git-repo\n```\n\nBrowse on ClawHub: <https://clawhub.ai/skills/git-repo>\n\n### Peer skills\n\n`git-repo` depends on `commit-tidy`. Install it too:\n\n```bash\nnpx skills add es6kr/skills --skill commit-tidy\n```\n\n## Usage\n\nInvoke with `/git-repo <topic>` (for example `/git-repo worktree`). See [`SKILL.md`](./SKILL.md) for the full topic list."},{"path":"_meta.json","content":"{\n  \"ownerId\": \"kn74k8yfvftx6f062qa8fzyd8h8373jd\",\n  \"slug\": \"git-repo\",\n  \"version\": \"0.13.0\",\n  \"publishedAt\": 1791543251385\n}"},{"path":"CHANGELOG.md","content":"# Changelog\n\n## [0.13.0](https://github.com/es6kr/skills/compare/git-repo-v0.12.1...git-repo-v0.13.0) (2026-10-06)\n\n\n### Features\n\n* **hook-kit:** declarative step-dependency enforcement engine ([9e3d188](https://github.com/es6kr/skills/commit/9e3d18898453d20a947b74b24032e61bf13bc297))\n\n## [0.12.1](https://github.com/es6kr/skills/compare/git-repo-v0.12.0...git-repo-v0.12.1) (2026-10-04)\n\n\n### Bug Fixes\n\n* **git-repo:** add COND-HOOK-REG check for hooks.json integrity in doctor ([#590](https://github.com/es6kr/skills/issues/590)) ([f79bd24](https://github.com/es6kr/skills/commit/f79bd24bc783f488fcab834137efbbf485e579df))\n* **git-repo:** document bash-guard-safe resolution for proven-redundant rebase picks ([a085426](https://github.com/es6kr/skills/commit/a08542616db356db9d4dba63cef72d420d4c40c0))\n* **git-repo:** document upstream-tracking gotcha when branching off a remote-tracking ref ([#583](https://github.com/es6kr/skills/issues/583)) ([04004f9](https://github.com/es6kr/skills/commit/04004f9c506f8b99598b8ea25deb0e928ab632c4))\n* **git-repo:** register safe-relocate in the Topics table ([#591](https://github.com/es6kr/skills/issues/591)) ([6eddf07](https://github.com/es6kr/skills/commit/6eddf079e242fcdae4a3dd94de01410ffb6cbf82))\n\n## [0.12.0](https://github.com/es6kr/skills/compare/git-repo-v0.11.1...git-repo-v0.12.0) (2026-09-24)\n\n\n### Features\n\n* **fix-plan:** add pipeline log and hook integrity check scripts ([e93a432](https://github.com/es6kr/skills/commit/e93a4323b54a311fcda6855163ffe14c2c146412))\n* **git-repo:** add prune_merged_worktrees.py script and guide ([37e6f16](https://github.com/es6kr/skills/commit/37e6f16474701606c4819c28ce480117dbc3b940))\n\n\n### Bug Fixes\n\n* **git-repo:** add prune_merged_worktrees.py + 7 accumulated fixes ([3d2ee94](https://github.com/es6kr/skills/commit/3d2ee9425285347d8f7e7698049d6e5769f73f92))\n* **git-repo:** document prune_merged_worktrees.py in the worktree decision tree and Scripts list ([bb979ca](https://github.com/es6kr/skills/commit/bb979ca3dcd1e4c03aa39e594134bff6d4163eba))\n* **git-repo:** refine repo scan logic to accurately detect root git repositories ([f970a45](https://github.com/es6kr/skills/commit/f970a45f9c9cc3464473052de3ee69a51235369b))\n* **git-repo:** require exact HEAD SHA match before pruning a GitHub-merged worktree ([3d9b7fa](https://github.com/es6kr/skills/commit/3d9b7fae427f484640e05a837394a8eb3f9f3736))\n\n## [0.11.1](https://github.com/es6kr/skills/compare/git-repo-v0.11.0...git-repo-v0.11.1) (2026-09-18)\n\n\n### Bug Fixes\n\n* **cleanup:** make the session-end report table self-sufficient ([#487](https://github.com/es6kr/skills/issues/487)) ([c4a0255](https://github.com/es6kr/skills/commit/c4a02557fb8de3b32cf337c549f62535dabf824b))\n* **git-repo:** stop SIGPIPE from silently disabling every Tier 2 doctor check ([#484](https://github.com/es6kr/skills/issues/484)) ([ab5a64d](https://github.com/es6kr/skills/commit/ab5a64d6c25cf7ab560c4e9b47c860bac94d7fc2))\n\n## [0.11.0](https://github.com/es6kr/s"},{"path":"clone.md","content":"# ghq Clone\n\nWorkflow for automatically registering in SourceGit after `ghq get`.\n\n## When to Use\n\n- User runs `ghq get <url>`\n- User mentions \"ghq clone\", \"ghq get\", \"clone repository\"\n- Skill arguments contain URL (https:// or git@)\n\n## Workflow\n\n### Step 0: Pre-Clone Check (verify existing repository)\n\n**CRITICAL**: Check for existing repository before running ghq get\n\n#### 0-1. Check existing paths\n\nExtract repo name from URL and check related paths:\n\n```bash\n# 1. ghq default repository (ghq checks automatically - skip)\n# ~/ghq/host/group/repo\n\n# 2. Check bare repository (ghq does NOT check this!)\nls ~/ghq/host/group/repo.git 2>/dev/null\n\n# 3. Check existing worktree paths (paths registered in SourceGit)\n# ~/works/group/repo format\n```\n\n#### 0-1a. Handle broken clone remnants\n\nIf a directory with only an empty `.git` remains from a previously failed clone, `ghq get` will skip it as \"exists\":\n\n```bash\n# Detect broken repository\ncd ~/ghq/host/group/repo && git status 2>&1\n# → \"fatal: not a git repository\" → broken state\n\n# Move broken directory and re-clone\nmv ~/ghq/host/group/repo ~/.claude/.bak/repo_$(date +%Y%m%d)\n```\n\n#### 0-2. When bare repository exists\n\nIf a bare repository (`~/ghq/.../repo.git`) is found:\n\n1. **Check status**: Verify connected worktrees and changes\n2. **Convert if needed**: Can convert to regular repository using `migrate` topic\n\n#### 0-3. Check SourceGit registration path\n\nCheck if existing repository is registered in SourceGit:\n\n```bash\n# Search for repo name in preference.json\ngrep -l \"repo-name\" ~/Library/Application\\ Support/SourceGit/preference.json\n```\n\nIf a registered path is found:\n\n1. Check for changes at that path\n2. Check if `.git` is a file (recommend conversion if it's a worktree)\n\n### Step 1: Clone with ghq\n\nAfter pre-check passes:\n\n```bash\nghq get <url>\n```\n\nParse cloned path from output:\n\n- Extract path from `clone https://... -> /path/to/repo` format\n\n### Step 1.5: Repository `.gitignore` Hygiene Baseline Check\n\nVerify that the cloned repository has standard baseline ignores configured (or add to `.git/info/exclude` / `.gitignore`):\n\n- `.worktrees/` (Worktree isolation)\n- `.DS_Store` (OS junk)\n- `__pycache__/` (Python bytecode cache)\n- `*.bak` (Local backup files)\n- `*.tmp` (Temporary files)\n\n```bash\n# Verify baseline ignore patterns\ncd /path/to/repo\ngrep -q \"^\\.worktrees/\" .gitignore 2>/dev/null || echo -e \"\\n# Worktrees & Runtime\\n.worktrees/\\n.DS_Store\\n__pycache__/\\n*.bak\\n*.tmp\" >> .gitignore\n```\n\n### Step 2: Parse Repository Info\n\nExtract host/group/repo from URL:\n\n- `https://github.com/org/repo.git`\n  - Host: `github.com`\n  - Group: `org`\n  - Repo: `repo`\n\n### Step 3: Check SourceGit Status\n\n```bash\npgrep -x SourceGit\n```\n\n- **Running**: **Skip** SourceGit registration and report clone path only. When SourceGit exits, it overwrites preference.json on disk with its in-memory version, so edits made while running will be lost.\n- **Not running**: Proceed with registration\n\n### Step 4: Read preferenc"}],"languages":[],"docsSourceLabel":"CLAWHUB","editorialOverview":null,"editorialQuality":{"score":100,"threshold":65,"status":"thin","wordCount":1736,"uniquenessScore":40,"reasons":["uniqueness-below-45"]}},"media":{"evidence":{"source":"no-media","verified":false,"confidence":"low","updatedAt":"2026-10-09T11:24:21.942Z","emptyReason":"No screenshots, media assets, or demo links are available."},"primaryImageUrl":null,"mediaAssetCount":0,"assets":[],"demoUrl":null},"ownerResources":{"evidence":{"source":"unclaimed","verified":false,"confidence":"low","updatedAt":"2026-10-09T11:24:21.942Z","emptyReason":"This page has not been claimed by the agent owner."},"hasCustomPage":false,"customPageUpdatedAt":null,"customLinks":[],"structuredLinks":{"docsUrl":null,"demoUrl":null,"supportUrl":null,"pricingUrl":null,"statusUrl":null},"customPage":null},"relatedAgents":{"evidence":{"source":"protocol-neighbors","verified":false,"confidence":"medium","updatedAt":"2026-10-09T11:35:59.290Z","emptyReason":null},"items":[{"id":"b917f68a-ebff-438e-84f8-3f4b2494c0bc","entityType":"agent","canonicalPath":"/agent/activepieces-activepieces","slug":"activepieces-activepieces","name":"activepieces","description":"AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents","url":"https://github.com/activepieces/activepieces","homepage":"https://www.activepieces.com","source":"GITHUB_REPOS","protocols":["OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-04-15T02:22:12.426Z","createdAt":"2026-02-25T03:38:12.412Z","downloads":null},{"id":"5cb26759-3a39-483f-94cf-276a98c13bb8","entityType":"agent","canonicalPath":"/agent/cherryhq-cherry-studio","slug":"cherryhq-cherry-studio","name":"cherry-studio","description":"AI productivity studio with smart chat, autonomous agents, and 300+ assistants. Unified access to frontier LLMs","url":"https://github.com/CherryHQ/cherry-studio","homepage":"https://cherry-ai.com","source":"GITHUB_REPOS","protocols":["MCP","OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-04-11T14:38:40.986Z","createdAt":"2026-02-25T03:38:19.379Z","downloads":null},{"id":"8ebccd8e-3863-4187-8355-c3f14e1f9edf","entityType":"agent","canonicalPath":"/agent/iofficeai-aionui","slug":"iofficeai-aionui","name":"AionUi","description":"Free, local, open-source 24/7 Cowork app and OpenClaw for Gemini CLI, Claude Code, Codex, OpenCode, Qwen Code, Goose CLI, Auggie, and more | 🌟 Star if you like it!","url":"https://github.com/iOfficeAI/AionUi","homepage":"https://www.aionui.com","source":"GITHUB_REPOS","protocols":["MCP","OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-04-10T18:48:31.762Z","createdAt":"2026-02-25T03:38:16.584Z","downloads":null},{"id":"6f6582d0-5d76-4f0f-b81d-86520247950b","entityType":"agent","canonicalPath":"/agent/copilotkit-copilotkit","slug":"copilotkit-copilotkit","name":"CopilotKit","description":"The Frontend for Agents & Generative UI. React + Angular","url":"https://github.com/CopilotKit/CopilotKit","homepage":"https://docs.copilotkit.ai","source":"GITHUB_REPOS","protocols":["OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-03-25T09:50:57.846Z","createdAt":"2026-02-25T03:39:14.617Z","downloads":null}],"links":{"hub":"/agent","source":"/agent/source/clawhub","protocols":[{"label":"OpenClaw","href":"/agent/protocol/openclew"}]}}}