git - recover deleted files from a prior commit

Posted by Walter White on Super User See other posts from Super User or by Walter White
Published on 2011-04-20T15:32:31Z Indexed on 2012/11/06 23:06 UTC
Read the original article Hit count: 207

Filed under:

I accidentally deleted some files in a prior commit and would like to recover them. How can I do this?

I ran this and found exactly what I was looking for:

git whatchanged --diff-filter=D

At the time I made the commit, I should have committed the new/changed files only and ran a reset --hard then to recover the missing files. I have about 100 files that I need to restore.

I don't want to do a straight revert as that will also undo the changes in that commit.

Any ideas?

© Super User or respective owner

Related posts about git