Recovering added/staged file after doing git reset –hard HEAD^?

You can (with some work) recover state of file at the last “git add <file>“. You can use

$ git fsck --cache --no-reflogs --lost-found --dangling HEAD

and then examine files in ‘.git/lost-found/other’ directory.

Please read git fsck manpage.

Leave a Comment