據 AlphaMoat 統計,截至 2026-09,Unfuck My Git State 累計下載 3,111 次、獲 1 個星標,在全部 5,078 個 AI 技能中排名第 3,650 位,在「開發程式設計」分類(577 個)中排名第 463 位。
| 平台 | 累計安裝 | 累計下載 | 星標 | 評論 |
|---|---|---|---|---|
| ClawHub ↗ | 102 | 3083 | 1 | - |
| SkillHub ↗ | 101 | 3111 | 1 | — |
各平台的計數口徑不同,統計時間不一致。
流程要求先建立狀態快照、根據症狀選擇修復方案,優先採用非破壞性步驟,並在每次修復後驗證;手動修改 .git 後設資料前應先備份。錯誤地調整 HEAD、引用或 worktree 可能影響倉庫狀態,因此應先明確症狀和目標,避免直接執行不匹配的恢復命令。
資料釋出於 2026-10-29
.git、分支引用或 worktree 的操作前,需要先備份並核實目標倉庫時。以下是根據技能文件生成的示例,不代表實際執行結果。
2026-09 起統計方法調整:同名技能按作者分別統計,並覆蓋全部技能。圖中虛線為調整前的月份,與之後的資料不直接比較,也不計算跨越調整的增長。
| 月份 | 累計下載 | 環比 | 星標 |
|---|---|---|---|
| 2026-09 | 3111 | — | 1 |
| 2026-08 | 2999 | +3.4% | 1 |
| 2026-07 | 2900 | +7.5% | 1 |
| 2026-06 | 2697 | +4.9% | 1 |
| 2026-05 | 2572 | — | 1 |
| 2026-03 | 2222 | — | 1 |
以下是作者釋出的原始檔案,按純文字顯示,本站未做修改或稽核;其中的連結不可點選,命令請核實後再執行。抓取於 2026-10-23。
--- name: unfuck-my-git-state description: Diagnose and recover broken Git state and worktree metadata with a staged, low-risk recovery flow. Use when Git reports detached or contradictory HEAD state, phantom worktree locks, orphaned worktree entries, missing refs, 0000000000000000000000000000000000000000 hashes, or branch operations fail with errors like already checked out, unknown revision, not a valid object name, or cannot lock ref. --- # unfuck-my-git-state Recover a repo without making the blast radius worse. ## Core Rules
1. Snapshot first. Do not "just try stuff." 2. Prefer non-destructive fixes before force operations. 3. Treat `.git/` as production data until backup is taken. 4. Use `git symbolic-ref` before manually editing `.git/HEAD`. 5. After each fix, run verification before proceeding. ## Fast Workflow 1. Capture diagnostics: ```bash bash scripts/snapshot_git_state.sh . ``` 2. Route by symptom using `references/symptom-map.md`. 3. Generate non-destructive command plan: ```bash bash scripts/guided_repair_plan.sh --repo . ``` 4. Apply the smallest matching playbook. 5. Run `references/recovery-checklist.md` verification gate. 6. Escalate only if the gate fails. For explicit routing: ```bash bash scripts/guided_repair_plan.sh --list bash scripts/guided_repair_plan.sh --symptom phantom-branch-lock ``` ## Regression Harness Use disposable simulation tests before changing script logic: ```bash bash scripts/regression_harness.sh ``` Run one scenario: ```bash bash scripts/regression_harness.sh --scenario orphaned-worktree ``` ## Playbook A: Orphaned Worktree Metadata Symptoms: - `git worktree list` shows a path that no longer exists. - Worktree entries include invalid or zero hashes. Steps: ```bash git worktree list --porcelain git worktree prune -v git worktree list --porcelain ``` If stale entries remain, back up `.git/` and remove the specific stale folder under `.git/worktrees/<name>`, then rerun prune. ## Playbook B: Phantom Branch Lock Symptoms: - `git branch -d` or `git branch -D` fails with "already used by worktree". - `git worktree list` seems to disagree with branch ownership. Steps: ```bash git worktree list --porcelain ``` Find the worktree using that branch, switch that worktree to another branch or detach HEAD there, then retry the branch operation in the main repo. ## Playbook C: Detached or Contradictory HEAD Symptoms: - `git status` says detached HEAD unexpectedly. - `git branch --show-current` and `git symbolic-ref -q HEAD` disagree. Steps: ```bash git symbolic-ref -q HEAD || true git reflog --date=iso -n 20 git switch <known-good-branch> ``` If branch context is unknown, create a rescue branch from current commit: ```bash git switch -c rescue/$(date +%Y%m%d-%H%M%S) ``` Then reconnect to the intended branch after investigation. ## Playbook D: Missing or Broken Refs Symptoms: - `unknown revision`, `not a valid object name`, or `cannot lock ref`. Steps: ```bash git fetch --all --prune git show-ref --verify refs/remotes/origin/<branch> git branch -f <branch> origin/<branch> git switch <branch> ``` Use `reflog` to recover local-only commits before forcing branch pointers. ## Last Resort: Manual HEAD Repair Only after backup of `.git/`. Preferred: ```bash git show-ref --verify refs/heads/<branch> git symbolic-ref HEAD refs/heads/<branch> ``` Fallback when `symbolic-ref` cannot be used: ```bash echo "ref: refs/heads/<branch>" > .git/HEAD ``` Immediately run the verification gate. ## Verification Gate (Must Pass) Run checks in `references/recovery-checklist.md`. Minimum bar: - `git status` exits cleanly with no fatal errors. - `git symbolic-ref -q HEAD` matches intended branch. - `git worktree list --porcelain` has no missing paths and no zero hashes. - `git fsck --no-reflogs --full` has no new critical errors. ## Escalation Path 1. Archive `.git`: ```bash tar -czf git-metadata-backup-$(date +%Y%m%d-%H%M%S).tar.gz .git ``` 2. Clone fresh from remote. 3. Recover unpushed work with reflog and cherry-pick from old clone. 4. Document failure mode and add guardrails to automation. ## Automation Hooks When building worktree tooling (iMi, scripts, bots), enforce: - preflight snapshot and state validation - post-operation verification gate - hard stop on HEAD/ref inconsistency - explicit user confirmation before destructive commands ## Resources - Symptom router: `references/symptom-map.md` - Verification checklist: `references/recovery-checklist.md` - Diagnostic snapshot script: `scripts/snapshot_git_state.sh` - Guided plan generator: `scripts/guided_repair_plan.sh` - Disposable regression harness: `scripts/regression_harness.sh`
用 gh 命令列工具檢視 GitHub 上的 PR 檢查、工作流執行與 API 查詢的技能。
聚合 16 個搜尋引擎、無需 API Key 的檢索技能。
用命令列直接列出、配置、授權並呼叫 MCP 服務與工具。
根據文字描述生成 Mermaid 圖表程式碼。
用受管 OAuth 訪問 YouTube Data API,檢索影片並管理頻道內容。
透過受管的 OAuth 連線訪問 GitHub REST API。
覆蓋規劃、實現、驗證與測試的編碼工作流技能。
整理 Docker 常用命令與容器工作流的技能。
資料月份:2026-09 · 下載/星標/安裝數聚合自公開技能註冊庫(ClawHub、SkillHub),按月更新。口徑說明見資料方法。