How to fix `rm -f .git/index`
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.
The way to fix this:
If you instead do this (note the lack of ".lock" at the end):
then your git repo will behave in very weird ways. For instance,
status won't work, and other things break in odd ways. Here's the
git read-tree --reset HEAD
You'll lose unstaged changes, but you'll have your repo back.