logoalt Hacker News

Tade0today at 5:28 PM4 repliesview on HN

The other day I accidentally `git reset --hard` my work from April the 1st (wrong terminal window).

Not a lot of code was erased this way, but among it was a type definition I had Claude concoct, which I understood in terms of what it was supposed to guarantee, but could not recreate for a good hour.

Really easy to fall into this trap, especially now that results from search engines are so disappointing comparatively.


Replies

ejpirtoday at 7:53 PM

have you tried to recover it with git reflog?

https://oneuptime.com/blog/post/2026-01-24-git-reflog-recove...

smillikentoday at 5:42 PM

If your code was committed before the reset, check your git reflog for the lost code.

ajdegoltoday at 6:55 PM

Guess you’ve sorted it but it might be in the session memory in your root folder. I’ve recovered some things this way.

jatinstoday at 5:40 PM

> but could not recreate for a good hour.

For certain work, we'll have to let go of this desire.

If you limit yourself to whatever you can recreate, then you are effectively limiting the work you can produce to what you know.

show 1 reply