Earlier today I accidently corrupted my git index file and got the following error message

fatal: index file smaller than expected  

Luckily, I didn't have any staged changes, so I ran the following commands to reset and fix it.

rm .git/index  
git reset HEAD .