I deleted a tracked file locally
The below applies only for tracked files. If you deleted a file which you hadn’t previously committed, it might be gone for good, depending on the deletion method.
For tracked files, however, you can do the following.
Restore the status of the file in the index:
git reset -- <filename>
Undo the deletion:
git checkout -- <filename>