index


Git: fatal: index file smaller than expected

Recently, we got the following error from git

$ git status
 fatal: index file smaller than expected

To fix it, without losing local changes, we removed the corrupted index and reset back to the HEAD using the following commands:

$ rm .git/index
$ git reset HEAD .