Claude Skills
CollectionsCompareWorkflowsNominate
Sign inSign up
© 2026 Curated Agent Skills·Learn more about Agent Skills
Back to repository

git-recovery-command

verified

[GIT] Recovery from git mistakes. Use when you need to undo commits, recover branches, or fix history.

View on GitHub

Marketplace

orchestkit

yonatangross/orchestkit

Plugin

ork

development

Repository

yonatangross/orchestkit
55stars

plugins/ork/skills/git-recovery-command/SKILL.md

Last Verified

February 4, 2026

Install Skill

Select agents to install to:

Scope:
npx add-skill https://github.com/yonatangross/orchestkit/blob/main/plugins/ork/skills/git-recovery-command/SKILL.md -a claude-code --skill git-recovery-command

Installation paths:

Claude
.claude/skills/git-recovery-command/
Powered by add-skill CLI

Instructions

# Git Recovery

Interactive recovery from common git mistakes. Safe operations with verification steps.

## Quick Start

```bash
/git-recovery
```

## Recovery Scenarios

When invoked, present these options to the user:

### Option 1: Undo Last Commit (Keep Changes)

**Scenario**: You committed but want to modify the changes before recommitting.

```bash
# Check current state first
git log --oneline -3
git status

# Undo commit, keep changes staged
git reset --soft HEAD~1

# Verify
git status  # Changes should be staged
git log --oneline -1  # Previous commit is now HEAD
```

**Safety**: Non-destructive. All changes remain staged.

---

### Option 2: Undo Last Commit (Discard Changes)

**Scenario**: You committed something completely wrong and want to throw it away.

**WARNING: DESTRUCTIVE - Changes will be lost!**

```bash
# CRITICAL: First, save a backup reference
BACKUP_REF=$(git rev-parse HEAD)
echo "Backup ref: $BACKUP_REF (save this to recover if needed)"

# Show what will be lost
git show HEAD --stat

# Confirm with user before proceeding
# Then execute:
git reset --hard HEAD~1

# Verify
git log --oneline -3
git status  # Should be clean
```

**Recovery**: If you made a mistake, run `git reset --hard $BACKUP_REF`

---

### Option 3: Recover Deleted Branch

**Scenario**: You deleted a branch and need it back.

```bash
# Find the branch's last commit in reflog
git reflog | grep -i "branch-name"
# Or search all recent activity:
git reflog --all | head -30

# Once you find the commit hash (e.g., abc1234):
git checkout -b recovered-branch abc1234

# Verify
git log --oneline -5
git branch -v | grep recovered
```

**Note**: Reflog keeps entries for ~90 days by default.

---

### Option 4: Reset File to Last Commit

**Scenario**: You modified a file and want to discard local changes.

**WARNING: DESTRUCTIVE - Uncommitted changes to file will be lost!**

```bash
# Show current changes to file
git diff path/to/file

# Confirm with user before proceeding
# Then restore:

Validation Details

Front Matter
Required Fields
Valid Name Format
Valid Description
Has Sections
Allowed Tools
Instruction Length:
5786 chars