Say I\'m in a Git repository. I delete a file and commit that change. I continue working and make some more commits. Then, I find I need to restore that file.
I know
If you know the commit that deleted the file(s), run this command where
is the commit that deleted the file:
git diff --diff-filter=D --name-only ~1 | xargs git checkout ~1 --
The part before the pipe lists all the files that were deleted in the commit; they are all checkout from the previous commit to restore them.