git-undo-wizard

git-undo-wizard is a skill for Claude Code from latestaiagents/agent-skills. It costs 74 tokens per session (1,378 once invoked), scanned A, original, MIT.

A guide for recovering from Git mistakes, including unwanted commits, changes on the wrong branch, deleted branches or files, and accidental merges.

In plain words
What is it for?
Undoing or reverting commits, unstaging changes, restoring files, undoing merges, and recovering deleted branches with Git history.
Why use it?
It helps choose a recovery method that preserves work when possible and warns when an action may permanently discard changes.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the developer-toolkit plugin — 19 skills shipped together

Good fit Undoing or reverting commits, unstaging changes, restoring files, undoing merges, and recovering deleted branches with Git history.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/latestaiagents/agent-skills/git-undo-wizard
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add latestaiagents/agent-skills --skill git-undo-wizard
Clone the repo
git clone --depth 1 https://github.com/latestaiagents/agent-skills

Made for: Claude Code.

Or install developer-toolkit, the plugin that ships this one along with the rest of its 19 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for git-undo-wizard

README.md
[![agentmods](https://agentmods.dev/badge/skills/latestaiagents/agent-skills/git-undo-wizard/github.svg)](https://agentmods.dev/skills/latestaiagents/agent-skills/git-undo-wizard)
Your own site
<a href="https://agentmods.dev/skills/latestaiagents/agent-skills/git-undo-wizard"><img src="https://agentmods.dev/badge/skills/latestaiagents/agent-skills/git-undo-wizard/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for git-undo-wizard

Your own site · 80×15
<a href="https://agentmods.dev/skills/latestaiagents/agent-skills/git-undo-wizard"><img src="https://agentmods.dev/badge/skills/latestaiagents/agent-skills/git-undo-wizard.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 74 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,378 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00074 $0.01378
Opus 5.5 $0.00030 $0.00551
Sonnet 5.5 $0.00015 $0.00276
Haiku 4.5 $0.00007 $0.00138

Measured 3mo ago against content hash fbfce20d2dbb, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

git-undo-wizard scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/developer-toolkit/skills/git/git-undo-wizard/SKILL.md · 243 lines

How it starts

The opening of the file, as written. The whole thing — 243 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Git Undo Wizard

Recover from any Git mistake safely.

When to Use

  • Accidentally committed to wrong branch
  • Need to undo a commit (before or after push)
  • Accidentally deleted a branch or file
  • Need to recover lost commits
  • Want to undo a merge
  • Committed sensitive data by mistake

Quick Reference

Situation Command
Undo last commit, keep changes git reset --soft HEAD~1
Undo last commit, discard changes git reset --hard HEAD~1
Undo changes to a file git checkout -- <file>
Undo staged changes git reset HEAD <file>
Undo a pushed commit git revert <commit>
Recover deleted branch git reflog + git checkout -b <branch> <sha>

Scenarios & Solutions

1. Undo Last Commit (Not Pushed)

Keep the changes (just uncommit):

git reset --soft HEAD~1
# Changes are now staged, ready to recommit

Unstage the changes too:

git reset HEAD~1
# Changes are in working directory, not staged

Discard everything (dangerous):

git reset --hard HEAD~1
# Changes are gone forever

2. Undo Last Commit (Already Pushed)

Safe way (creates a new "undo" commit):

git revert HEAD
git push
# This creates a new commit that undoes the previous one

If you MUST rewrite history (only on your own branch):

git reset --hard HEAD~1
git push --force-with-lease
# Never do this on shared branches!

3. Committed to Wrong Branch

Move commit to correct branch:

# Note the commit hash
git log -1  # Copy the hash

# Go to correct branch
git checkout correct-branch

# Cherry-pick the commit
git cherry-pick <commit-hash>

# Go back and remove from wrong branch
git checkout wrong-branch
git reset --hard HEAD~1

4. Undo Changes to a File

Discard unstaged changes:

git checkout -- <filename>
# Or in newer Git:
git restore <filename>

Unstage a file (keep changes):

git reset HEAD <filename>
# Or in newer Git:
git restore --staged <filename>

Read the full file on GitHub · 243 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3mo ago First seen · 243 lines · 74 tokens per session scan A fbfce20d2dbb

Subscribe to this mod's changes

git-undo-wizard is a skill published in the GitHub repository latestaiagents/agent-skills (6 stars, last pushed 28d ago), licensed MIT. It adds 74 tokens to every session and 1,378 once invoked, about $0.0003 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

git-undo-wizard compared with skills from other repositories

git-undo-wizard next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
git-undo-wizardlatestaiagents/agent-skillsSkill628d agoMITA74Claude Code
agentic-jujutsuruvnet/rufloSkill83ktodayMITA26Claude Code
agent-release-swarmruvnet/rufloSkill83ktodayMITA19Claude Code
github-automationruvnet/rufloSkill83ktodayMITA61Claude Code
upgrading-core-dependenciesJetBrains/thinkrailSkill8.5ktodayApache-2.0A59Claude Code, Codex
reviewing-a-prJetBrains/thinkrailSkill8.5ktodayApache-2.0A56Claude Code, Codex
about-thinkrailJetBrains/thinkrailSkill8.5ktodayApache-2.0A153Claude Code, Codex