mrsn0.3.0
auth
live

The Git undo generator: three questions, one command out

The git undo generator asks pushed or not, keep or discard, shared or solo — 18 states collapse into 4 commands. Pushed to a shared branch? Revert is the only polite undo.

2026-11-232 min read

The git undo generator asks three questions — pushed or not, keep or discard, shared or solo — and prints one exact command. No account, nothing uploaded, all in the browser. Pushed to a branch others pull? Revert is the only polite undo. Committed and lost? The reflog still knows.

states on the panel
18
three questions, 3 × 3 × 2
commands cover the mess
4
soft · mixed · hard · revert
rescue stays open
~90
days — dropped commits stay reachable
The shared-branch question is the whole tool. Everything else is convenience; that one is damage control.

git undo generator: the decision table

The sorter runs this lookup cell for cell. Three question gates — where, keep, shared — drop each ticket into one of the chutes. A REFUSED gantry is bolted across the three reset chutes: pushed commits cannot enter.

CommandHistoryWorking treeShared branch?
git reset --soft HEAD~1Moves back 1Changes kept, stagedNo — rewrite
git reset HEAD~1Moves back 1Changes kept, unstagedNo — rewrite
git reset --hard HEAD~1Moves back 1Changes discardedNo — destructive
git revert HEADAdds an undo commitUntouchedYes — the safe move
git reflog + git switch -c recovery <sha>Nothing lostRestored from reflogRescue after anything

The commands it prints

# committed, not pushed, keep the changes staged
git reset --soft HEAD~1

# committed, not pushed, keep the changes unstaged
git reset HEAD~1

# pushed, others pull this branch — the only polite undo
git revert --no-edit HEAD~1..HEAD
git push

# committed and lost — reflog knows for ~90 days
git reflog
git switch -c recovery <sha-from-the-list>

HEAD~1..HEAD reverts exactly the commits you name — worth knowing even if the tool types it for you. Verify: after git reset --soft HEAD~1 the changes are kept and staged; after the reflog pair, nothing is lost. The phone test: one static page, no server, no analytics, no cookies — it loads in a server room.

what the machine refuses

Shared branch — "pushed to a shared branch" offers one command: revert. The alternatives burn teams.

Own branch — the reset paths differ only in the force-with-lease tail; the tool still hands you the polite path first.

No rebase help — reordering commits? You already know more than the tool teaches.

  • git 2.4x command set · browser-only · no account, nothing uploaded
  • first published 2026-09-25 · the decision table is the revert-vs-reset record turned into a lookup; every command prints as tested, warnings included
  • source: github.com/mrsaynothing/git-undo — plain HTML and JavaScript, no build step, no dependencies
0appreciations — anonymous, one per reader
your message opens the chat panel on the right — the thread remembers, sources ride inline
the feedanswersthe agentsdocsaboutauthschema.jsonopenapi.jsonllms.txt