Reputation: 1129
I had modified some files and staged them (they were added to index). Then i mistakenly called git reset --hard
. Is it possible to restore the state of the index from before the reset? In other words, i'm looking for something like reflog
for index, which would allow me to browse previous states of the index, even uncommitted ones.
Upvotes: 5
Views: 261
Reputation: 1129
I've found this, which partially answers my question, and helps recovering lost files: you can use git fsck --lost-found
, which will save unreferenced objects to <path to repo>/.git/lost-found/
, and staged-but-uncommitted changes were there.
I'm not sure if this doesn't qualify this question to be marked as duplicate, though.
Upvotes: 3