0

I accidentally deleted files on my local machine and in git shell when I do a git status I see those files marked as deleted, how would I recover those files back to my local machine?

2 Answers2

1

If Git is showing you the files with a deleted status, you haven't committed your changes, and you can simply git checkout <name of deleted file>.

user229044
  • 232,980
  • 40
  • 330
  • 338
0

There is a chance that your IDE automatically stages your changes when you deleted your file. If this is the case, you will first have to reset that file to your current head before checking out the deleted file.

git reset HEAD path/to/file
git checkout path/to/file
Sam
  • 20,096
  • 2
  • 45
  • 71