It is very simple to get the locally deleted file in a git repository. Make sure that you are not committed any changes.
Suppose you deleted the file: myfolder/my_deleted_file.txtÂ accidentally and you want to retrieve the file from the server.
Execute the following command:
git checkout myfolder/my_deleted_file.txt
That’s it. Your file is now restored to the folder.