Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
what operating-system do you use? – wullxz Apr 20 '11 at 15:42
look over here. They found allready an answer to exact the same question. – wullxz Apr 20 '11 at 15:45
Perfect, I found something that will work for me. I wrote a nice tiny script to put together a list of files and then checkout those files. – Walter White Apr 20 '11 at 18:03

Check out (clone) to somewhere and do the revert there. Extract your files and delete somewhere afterwards.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.