How to recover `rm .git/index`?
How to recover
rm .git/index
If, in order to fix this git error 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.
you inadvertently
rm .git/index
instead ofrm .git/index.lock
, your repository index will be messed up.
Here is how to fix it:
git read-tree --reset HEAD
last updated february 2020