Sometimes using Visual Studio Git Extensions, while switching in and out of Git branches, you may encounter this error:
error: bad index file sha1 signaturefatal: index file corrupt
Your Git index may get corrupted, and here is a quick fix to restore your index to your last commit:
1. Open Git bash by going to Start-> All Programs-> Git-> Git Bash. This will open up the Git bash command prompt window.
2. Go to your local repository folder (using cd c:\>path to my repository )
3. Type: $ rm -f .git/index
4. Then type: $ git reset
Now your index is re-loaded to your last commit. You may want to check your commits again and push/pull changes to that branch just to bring it uptodate.