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-his wayyy too easy to mix up with--help, there will be a confirmation when-his 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 to1, 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 <me@kennethreitz.com> and Nick Lombard <github@jigsoft.co.za> β 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
- ubuntu stonking: git-extras 7.5.0-1 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms