Progrider

Programming discussion

Board index
Help · ✓ Resolved

ran git reset --hard and lost today

had everything staged, hadn't committed, meant to do reset --soft. is it gone

4 replies

Staged is good news. git add wrote the blobs into the object store, they just have no name now. git fsck --lost-found Then look in .git/lost-found/other. You get the contents without the filenames. Don't run git gc in the meantime. Anything you changed but hadn't staged is gone, unless your editor kept a copy.
thank you thank you. 14 files. file names were easy to work out from the contents
reflog is for commits, for anyone reading this later. It doesn't help here because nothing was committed. Which is why you commit often and squash later.
yes yes i know. wip commits from now on

Discussion resolved

This discussion is resolved. Its creator can reopen it to accept more replies.