[git] Git - deleted some files locally, how do I get them from a remote repository

I've deleted some files on my PC, how do I download them again?

Pull says: "Already up-to-date".

This question is related to git

The answer is


git checkout filename

git reset --hard might do the trick as well


Also, I add to do the following steps so that the git repo would be correctly linked with the IDE:

 $ git reset <commit #>

 $ git checkout <file/path>

I hope this was helpful!!


If you deleted multiple files locally and did not commit the changes, go to your local repository path, open the git shell and type.

$ git checkout HEAD .

All the deleted files before the last commit will be recovered.

Adding "." will recover all the deleted the files in the current repository, to their respective paths.

For more details checkout the documentation.


You need to check out a previous version from before you deleted the files. Try git checkout HEAD^ to checkout the last revision.


If you have deleted multiple files locally but not committed, you can force checkout

$ git checkout -f HEAD