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 .

This post is also available in: Greek

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.