ctilley79
ctilley79

Reputation: 2195

Rails 3.1 Deleted folder can I recover with git?

OK. I was deleting precompiled assets in my public/assets folder. I accidentally deleted an entire folder I had in there as well. I checked out a repository and started webrick and the files seem to be loading, although when I look in the directory they aren't there? how do i restore/move those files back into the public/assets directory?

Upvotes: 6

Views: 6232

Answers (1)

Felipe Cypriano
Felipe Cypriano

Reputation: 2737

If you haven't commited the deletion. Check the changes that are pending with git status and use git checkout to restore a file to its last commited state ( HEAD ):

git checkout -- file_path

Git works on files not on directories.

Upvotes: 12

Related Questions