Retrieve missing files from remote repo?

git checkout .

How do I discard unstaged changes in Git?


You should just be able to either revert the commit with the deletions, or reset HEAD to the commit before you did the deletes, depending on whether you want to keep the deletions in the history or not.

Alternatively, if you haven't committed the deletes yet, you can just checkout the deleted files to restore them from your local repo.


To discard all local changes, you can do:

git checkout .

To avoid losing local changes, do this instead:

git ls-files -d -z | xargs -0 git checkout --

(Taken from http://data.agaric.com/restore-locally-deleted-files-git They also suggest using git update -- . but that is not a valid git command.)