unfuck-my-git-state

Diagnose and recover corrupted Git repository states with staged repairs.

Updated Mar 7, 2026
One-click install
npx skills add https://github.com/billyfranklim1/claude-skills --skill unfuck-my-git-state
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: unfuck-my-git-state
Source: https://github.com/billyfranklim1/claude-skills/tree/main/plugins/unfuck-my-git-state/skills/unfuck-my-git-state
Command: npx skills add https://github.com/billyfranklim1/claude-skills --skill unfuck-my-git-state

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Diagnose and recover a broken Git state and misconfigured worktree metadata without escalating risk, especially when HEAD is detached, locks exist, or refs are missing.

Core Features & Use Cases

  • Staged, low-risk recovery flow to minimize blast radius and preserve history.
  • Playbooks A–D cover orphaned worktrees, phantom locks, detached HEAD, and missing refs with clear steps and verification.
  • Verification gates ensure repo integrity after each fix before proceeding.

Quick Start

Begin by backing up the repository's .git directory and follow the staged recovery playbooks to repair HEAD and worktree state.

Frequently Asked Questions about unfuck-my-git-state

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I recover a detached HEAD state in my local git repository?

To recover a detached HEAD state safely, this Skill applies a staged, non-destructive workflow with backups and verification gates to repair HEAD and restore branch alignment without losing history.

What is the best way to fix missing refs in a corrupted git worktree?

The best way to fix missing refs is through targeted repairs guided by verification gates, ensuring repository integrity is validated after each step before proceeding to the next fix.

How do I clear phantom locks and conflicting branch operations across local clones?

You clear phantom locks and resolve conflicting branch operations by following staged recovery playbooks that perform targeted repairs on worktree metadata and refs while preserving existing history.

Does this git recovery workflow require backing up the .git directory first?

Yes, the recovery workflow requires backing up the repository's .git directory first to minimize blast radius and provide a fallback before attempting any HEAD or worktree state repairs.

Why should I use a staged recovery process for an orphaned worktree instead of forcing updates?

A staged recovery process prevents data loss by using verification gates to check repo integrity after each fix, whereas forcing updates risks corrupting worktree metadata and permanently losing history.