git-undo-wizard

git-undo-wizard is a skill for Claude Code, Codex 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 CodeCodex

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

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.

agentmods
npx agentmods add skills/latestaiagents/agent-skills/git-undo-wizard
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, Codex.

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.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.svg" alt="Measured on agentmods" 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. Scan, not verified.
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 $0.00074 $0.01378
Opus 5 $0.00037 $0.00689
Sonnet 5 $0.00015 $0.00276
Haiku 4.5 $0.00007 $0.00138

Measured 4d ago against content hash fbfce20d2dbb, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, 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 4d 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. 4d 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 (5 stars, last pushed 4mo ago), licensed MIT. It adds 74 tokens to every session and 1,378 once invoked, about $0.0004 per session on Opus 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

Other skills, from other repositories

git-flow-master

End-to-end Git operator for any branching strategy. Auto-detects the project's strategy (solo-main, main+integration, enterprise multi-branch, trunk-based, GitFlow, GitHub Flow, GitLab Flow, SDET integration-trunk for chained test-automation suites) from .git config, branches, and the gitstrategy: block in…

upex-galaxy/agentic-qa-boilerplate · 502 tokens

test-automation

Plan, write, and review automated tests following KATA (Komponent Action Test Architecture) on Playwright + TypeScript, or explain existing automated tests in a sealed read-only mode. Use when writing E2E or API/integration tests, creating Page or Api components, designing ATCs, parameterizing test data, registering…

upex-galaxy/agentic-qa-boilerplate · 151 tokens

framework-development

Framework evolution mode — evolves the QA boilerplate itself (KATA, fixtures, cli/, scripts/, api/schemas/ pipeline, package.json deps). Self-contained Plan → Code → Verify → Archive pipeline; runs under the gentle-ai install --preset minimal install (no SDD- skills required). Use when adding new fixture APIs…

upex-galaxy/agentic-qa-boilerplate · 196 tokens

agentic-qa-core

Foundation skill that hosts shared references cited by other workflow skills (briefing template, dispatch patterns, orchestration doctrine, skill composition strategy). Loaded on demand by shift-left-testing, sprint-testing, test-documentation, test-automation, regression-testing, project-discovery, adapt-framework…

upex-galaxy/agentic-qa-boilerplate · 115 tokens

judgment-day

Trigger: judgment day, dual review, adversarial review, juzgar. Run blind dual review, fix confirmed issues, then re-judge.

upex-galaxy/agentic-qa-boilerplate · 33 tokens

sprint-testing

Orchestrates in-sprint manual QA per issue across Stages 1 (Planning), 2 (Execution) and 3 (Reporting). Use for user-story testing, bug retesting, and sprint-wide QA loops. Creates the PBI folder, drives session-start, runs the triage + veto + risk-score decision tree on bugs, produces the ATP + ATR + TC artifacts in…

upex-galaxy/agentic-qa-boilerplate · 213 tokens