git recover deleted file where no commit was made after the delete

You've staged the deletion so you need to do:

git checkout HEAD cc.properties store/README store/cc.properties

git checkout . only checks out from the index where the deletion has already been staged.


The output tells you what you need to do. git reset HEAD cc.properties etc.

This will unstage the rm operation. After that, running a git status again will tell you that you need to do a git checkout -- cc.properties to get the file back.

Update: I have this in my config file

$ git config alias.unstage
reset HEAD

which I usually use to unstage stuff.


Just do git checkout path/to/file-I-want-to-bring-back.txt

Tags:

Git