Ever gotten this message?
fatal: Unable to create '/path/to/repo/.git/index.lock': File exists.
If no other git process is currently running, this probably means a git process crashed in this repository earlier. Make sure no other git process is running and remove the file manually to continue.
rm .git/index.lock
If you instead do this (note the lack of “.lock” at the end):
rm .git/index
then your git repo will behave in very weird ways.
For instance, git status won’t work, and other things break in odd ways.
Here’s the fix:
git read-tree --reset HEAD
You’ll lose unstaged changes, but you’ll have your repo back.