Unstaged changes left after abrupt shut down

120 Views Asked by At

I'm working on a git repository using git-scm.

While choosing unstaged files to commit, my laptop abruptly shut down due to low battery. After restart, all my unstaged changes were gone even if the changes were still there in files.

Any solution for this?

1

There are 1 best solutions below

0
On BEST ANSWER

You may need to rebuild the index and start over from the last commit:

rm -rf .git/index
git reset

This should leave you with your changes in the working tree and with an "empty" index.

I recomend that you do a backup before doing this.