GIT-UNDO(1)

πŸ’– git-undo β€” bestie, we're deleting commit history (gently) πŸ’–

okay so picture this: you just pushed... wait no, you just committed something cursed, and now you need it GONE. That's git-undo, from the Git Extras collection. It yoinks your latest commits off the top of the stack. No cap. 🫢


✨ NAME ✨

git-undo β€” remove latest commits πŸ’…


🌸 SYNOPSIS 🌸

git-undo [-s, --soft, -h, --hard] [<commitcount>]

πŸ¦‹ DESCRIPTION πŸ¦‹

It removes the latest commits. That's it, that's the whole vibe. The newest commit(s) at the tip of your history get taken out back. πŸ”₯


πŸŽ€ OPTIONS πŸŽ€

  • --soft, -s β€” rolls back the commit(s) but leaves the changes chilling in the staging area πŸ’œ so like, your work isn't gone, it's just un-committed and sitting pretty, ready for you to re-do it better.
  • --hard, -h β€” THIS ONE IS SCARY BESTIE. It wipes your commit(s), so your changes cannot be recovered. Use with care, fr fr 😭. And because -h is wayyy too easy to mix up with --help, there will be a confirmation when -h is specified β€” so the terminal will stop and ask you "are you SURE", and that's your last chance to back out. Don't skip past it. πŸ‘‘
⚠️ real talk: --hard + -h = gone forever. Not "gone but recoverable". Gone. Reflog can't save you from yourself on this one in spirit, so just... double-check before you type it.
  • <commitcount> β€” the number of commits to remove. Defaults to 1, so with no number it just removes the latest commit. Baby steps. 🌸

🌈 EXAMPLES 🌈

Removes the latest commit:

$ git undo

Removes the latest commit, restoring the staging area:

$ git undo -s

Remove the latest 3 commits:

$ git undo 3

πŸ’« AUTHOR πŸ’«

Written by Kenneth Reitz &lt;me@kennethreitz.com&gt; and Nick Lombard &lt;github@jigsoft.co.za&gt; β€” legends, honestly πŸ™Œ


πŸ› REPORTING BUGS πŸ›

Found a bug? Spill the tea here:

https://github.com/tj/git-extras/issues

πŸ‘€ SEE ALSO πŸ‘€

https://github.com/tj/git-extras

aaaand that's the whole page, bestie πŸŽ€ this gem is from the Git Extras source, dated May 2026, and the man page label up top is GIT-UNDO(1). Go forth and un-commit responsibly πŸ¦‹βœ¨πŸ’–

πŸ“¦ where this page comes from