I'm in a local branch. I've deleted a file. It is waiting to be staged and marked "deleted." I have not ran git rm
, git commit
, git add
, or anything else. How can I restore that file?
Asked
Active
Viewed 185 times
1

Andrew
- 20,756
- 32
- 99
- 177
-
1Possible duplicate of [git recover deleted file where no commit was made after the delete](http://stackoverflow.com/questions/11956710/git-recover-deleted-file-where-no-commit-was-made-after-the-delete) – Andrew C Dec 09 '15 at 18:39
3 Answers
1
git checkout [filename]
OR
git checkout * <-- if you want recover all files in commit

Felipe Pincheira
- 442
- 1
- 6
- 21
0
If you prefer to use git gui
, you can unstage the deleted file (clicking on the icon, thus moving it to the top part) and then use Commit - Revert Changes
(CTRL+J) to get the file back.

C-Otto
- 5,615
- 3
- 29
- 62