Git Undo and Reflog

Discussions center on Git's recovery features like reflog, reset, revert, and the debate over needing a simpler 'git undo' command versus trusting existing tools to prevent permanent data loss.

📉 Falling 0.5x DevOps & Infrastructure
2,595
Comments
20
Years Active
5
Top Authors
#2223
Topic ID

Activity Over Time

2007
1
2008
4
2009
26
2010
56
2011
86
2012
84
2013
138
2014
90
2015
66
2016
211
2017
146
2018
116
2019
185
2020
158
2021
204
2022
353
2023
240
2024
161
2025
228
2026
44

Keywords

jscal.es CLI stackoverflow.com OK HEAD github.com VCS scm.com TERRIBLE git undo reset branch commits repository rebase restore repo revert

Sample Comments

rossy Apr 11, 2018 View on HN

You shouldn't be able to lose any committed work in git. If you botch a merge, you can reset to one of the merge parents and try it again. If you botch a "destructive" operation like a reset or a rebase, you can undo it using the reflog, which is essentially a 30-day undo history for every branch in your repository.

svckr May 26, 2014 View on HN

Isn't that what git reflog + reset are for?

zach_garwood Jun 21, 2021 View on HN

This seems like putting a training wheel on a training wheel. git is already the easiest to understand of any VCS that I've used, and it's somewhat hard to do something in git that can't be reversed. As the articles states, it's unlikely you'll ever lose your changes. Further, this doesn't seem to be that different of a concept from git reset, so why not learn reset instead of yet another command?

amelius Jun 25, 2022 View on HN

Good modern software always offers an undo option. Where is "git undo"?

codesnik Jan 13, 2026 View on HN

whoa. well, if it really works for you. The thing is, git has practically zero "destructive" commands, you almost always (unless you called garbage collector aggressively) return to the previous state of anything committed to it. `git reflog` is a good starting point.I think i've seen someone coded user-friendlier `git undo` front for it.

solardev Jun 25, 2022 View on HN

It's needed when you're somebody who doesn't want to spend their life in git and just want to undo a mistake.

Grangar Aug 25, 2016 View on HN

What's wrong with git revert?

globular-toast Oct 3, 2025 View on HN

No need to make a "backup" branch. Learn to trust the reflog.

exDM69 Apr 29, 2012 View on HN

Unlike an exploding car, Git has undo. See git reflog.

ivanjermakov Jan 24, 2024 View on HN

Reflog to the rescue: https://git-scm.com/docs/git-reflog