Brian Pham
Brian Pham

Reputation: 561

Unstaged changes left after abrupt shut down

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?

Upvotes: 0

Views: 124

Answers (1)

joran
joran

Reputation: 2883

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.

Upvotes: 1

Related Questions