Back to Skills

recovering-from-bad-git-state

Techniques for diagnosing and recovering from corrupted git state, orphaned worktrees, and inconsistent branch references.

7starsUpdated 2/25/2026

Security Assessment

High Risk(40/100)

Detected risks:

Destructive Operations([SKILL.md] rm -rf)
Security Score40/100

About recovering-from-bad-git-state

The 'recovering-from-bad-git-state' skill provides a set of techniques for diagnosing and recovering from various issues in Git repositories, including corrupted git states, orphaned worktrees, and inconsistent branch references. It addresses problems that can prevent standard Git operations from functioning properly, such as missing references, detached HEAD states, and branch lock conflicts. This skill is crucial for developers who encounter unexpected errors while working with Git and need to restore repository integrity without losing their work or introducing new issues.

FAQ

When should I use this skill?

Use this skill when you encounter issues like corrupted HEAD references, orphaned worktrees, or problems with branch operations. These issues often show up as errors in commands like 'git worktree list' or 'git branch --show-current'.

Is this skill compatible with all Git versions?

Yes, the skill relies on common Git commands and functionality that should be available in most recent versions of Git. However, some advanced operations may vary depending on the specific Git version you're using.

What are the limitations of this skill?

This skill does not address every possible Git issue but focuses on state-related problems such as corrupted HEAD references and orphaned worktrees. If your issue falls outside these categories, this skill might not provide a solution.

Do I need to install any additional tools to use this skill?

No, the skill only uses standard Git commands and functionality, so no additional tools are required. The skill is designed to work directly with Git as it is.

What happens if the recovery operations do not work?

In cases where standard recovery operations fail, you may need to consider more advanced steps like rebuilding branch references or performing a more thorough manual cleanup of the repository.

Install recovering-from-bad-git-state

Download and extract the skill files to your .claude/skills/ directory.

Quick Setup:

  1. Copy the skill folder to .claude/skills/
  2. Claude will automatically detect and use the skill

Repository

delorenj/skills