The Prompt BakeryTemplates and prompts

Fix · GitHub and Git

Undo my last commit

What you may see

  • I committed too early or with the wrong message or files
  • I want to go back one step

Most likely cause

The saved version is wrong, and the right way to undo depends on whether it was already pushed.

Check first (about two minutes)

  1. Run git status and git log --oneline -3 -- is the last commit also on GitHub (compare with origin)?

The fix prompt

What you type here never leaves your browser. The search runs on this page, and nothing is sent to a server or to an AI.

Kept only in this browser, on this device. Keys and passwords are removed before anything is saved.

Prompt language

Paste it into Claude, ChatGPT, Gemini or Cursor, then follow what it says.

After you tried it, did it work?

Steps

  1. Run git status and git log --oneline origin/main..HEAD to tell me if my last commit was pushed.
  2. If NOT pushed: undo it but keep my edits with git reset --soft HEAD~1. For a wrong message only, use git commit --amend.
  3. If it WAS pushed: make a new commit that reverses it with git revert <hash>. Never rewrite pushed history.

Do not do this

  • Do not use git reset on commits that are already on GitHub.
  • Do not use --hard unless I ask for it and understand that it erases edits.

Related

Try another entry

How can we help?

What do you need?
Your email, so we can reply (optional)Only enter your own email. We reply there.