Git Undo Delete or Removal of Files


So, silly me. I wanted to remove a single directory from my changes. It was the only change made. I tried

git rm .

Git told me I needed to use -r to recursively delete files. I figured that meant it would delete recursively delete the files in that directory. NOT SO! It deleted all files in my repository.

Solution: http://stackoverflow.com/questions/9477702/undo-delete-in-git – the accepted answer from @manojlds

git checkout -f

I was saved!


Leave a Reply

Your email address will not be published. Required fields are marked *