Token导航 LogoToken导航TokenDH.com
研究检索需要联网clawhub未标认证来源可访问clear审计通过

unfuck-my-git-state搞砸我的 git 状态

Agent Skill

unfuck-my-git-state 用于记录任务执行中的错误、用户纠正、经验和能力缺口,适合在 OpenClaw 中希望让 Agent 持续沉淀问题、修正和最佳实践时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

72,112

周安装

3,035

GitHub Stars

1

下载量

25,251
OpenClaw

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

MIT-0

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:unfuck-my-git-state(搞砸我的 git 状态)
来源仓库:https://github.com/delorenj/unfuck-my-git-state
安装命令:
openclaw skills install unfuck-my-git-state
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 OpenClaw 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

ClawHubOpenClaw
openclaw skills install unfuck-my-git-state

简介

通过分阶段的低风险恢复流程诊断并恢复损坏的 Git 状态和工作树元数据。当 Git 报告分离或矛盾的 HEAD 状态、幻象工作树锁、孤立的工作树条目、缺少引用、0000000000000000000000000000000000000000 哈希值或分支操作失败并出现错误(例如已签出、未知修订、不是有效的对象名称或无法锁定引用)时使用。

SKILL.md

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 scripts/snapshot_git_state.sh .
  1. Route by symptom using references/symptom-map.md.
  2. Generate non-destructive command plan:
bash scripts/guided_repair_plan.sh --repo .
  1. Apply the smallest matching playbook.
  2. Run references/recovery-checklist.md verification gate.
  3. Escalate only if the gate fails.

For explicit routing:

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 scripts/regression_harness.sh

Run one scenario:

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:

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:

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:

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:

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:

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:

git show-ref --verify refs/heads/<branch>
git symbolic-ref HEAD refs/heads/<branch>

Fallback when symbolic-ref cannot be used:

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:
tar -czf git-metadata-backup-$(date +%Y%m%d-%H%M%S).tar.gz .git
  1. Clone fresh from remote.
  2. Recover unpushed work with reflog and cherry-pick from old clone.
  3. 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

适合场景

01

OpenClaw 用户查找和安装 Skill 时

02

用户想查找某类 Agent Skill 时

03

需要根据任务场景推荐可安装能力包时

04

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

OpenClaw

71.41%
按下载量换算18,032

安全审计

VirusTotal

通过

ClawScan

通过

Static analysis

未展示

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills