git-troubleshooting

Diagnose and recover from Git errors using reflog, cherry-pick, and reset.

8|2|Updated Oct 17, 2025
One-click install
npx skills add https://github.com/geoffjay/claude-plugins --skill git-troubleshooting
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: git-troubleshooting
Source: https://github.com/geoffjay/claude-plugins/tree/main/plugins/utilities/git/skills/git-troubleshooting
Command: npx skills add https://github.com/geoffjay/claude-plugins --skill git-troubleshooting

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes assets (resource) and references (resource) components.

What problem does it solve?

Accidental git reset --hard, merge conflicts, detached HEAD states, or even repository corruption can lead to lost work and significant frustration. This Skill provides a comprehensive guide to diagnose and recover from common Git mistakes, saving you time and stress.

Core Features & Use Cases

  • Recover Lost Commits: Utilize git reflog and git fsck to find and restore deleted branches or commits, ensuring no work is truly lost.
  • Fix Merge Conflicts: Get step-by-step guidance on resolving basic and complex merge conflicts, including how to use git mergetool effectively.
  • Undo Changes: Learn techniques for undoing local or public commits, discarding file changes, and recovering from botched rebases, safely.
  • Use Case: A developer accidentally performs a git reset --hard and loses several hours of work. This Skill guides them through using git reflog to identify the lost commits and restore their branch, saving their progress and reducing stress.

Quick Start

View local history of HEAD to find lost commits

git reflog

Recover a lost commit (e.g., abc123)

git cherry-pick abc123

Or create a new branch from it

git branch recovered-branch abc123

Frequently Asked Questions about git-troubleshooting

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

FAQPage Schema
How do I recover lost commits after git reset --hard?

Recover lost commits using git reflog to view your local HEAD history, then git cherry-pick to restore specific commits or git branch to create a new branch from a recovered commit. This retrieves work that appears deleted but remains in Git's internal objects.

What's the best way to resolve merge conflicts?

Resolve merge conflicts by editing conflicted files to remove conflict markers, staging changes with git add, then completing the merge. Use git mergetool for complex conflicts, or abort with git merge --abort if needed and restart the merge strategy.

How do I fix a detached HEAD state?

Fix a detached HEAD by creating a branch from your current position with git branch branch-name, then checking it out with git checkout. This anchors your commits to a named branch and prevents accidental loss if you switch away.

Can I undo a botched rebase safely?

Undo a botched rebase by using git reflog to locate your original branch state, then git reset --hard to return to it. Git preserves the history of HEAD movements, allowing safe recovery from interactive rebase mistakes.

How do I check if my repository is corrupted?

Check repository health with git fsck to verify object integrity and detect corruption. This command reports missing or broken objects, helping identify when a repository needs repair or recovery intervention.

Why does authentication fail when pushing to a remote?

Authentication failures during push typically stem from expired credentials, incorrect remote URLs, or missing SSH keys. Verify your git remote -v configuration, update credentials in your credential store, or configure SSH keys for your git hosting platform.