If your git index for some reason becomes invalid and you see this error running usual git commands like git pull
, git status
, etc.:
error: bad signature
fatal: index file corrupt
Though it sounds bad, your changes are still there. Fix it by first removing the index file, then resetting the branch:
rm .git/index
git reset
You should be all good now. To be safe, make a backup of .git/index
before you delete it.