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


I deleted some files.

I did NOT commit yet.

I want to reset my workspace to recover the files.

I did a git checkout ..

But the deleted files are still missing.

And git status shows:

# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#   deleted:
#   deleted:    store/README
#   deleted:    store/

Why doesn't git checkout . reset the workspace to HEAD?


The output tells you what you need to do. git reset HEAD 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 -- 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.

What's the difference between 'git reset' and 'git checkout'?

Default behavior of "git push" without a branch specified