views:

21

answers:

1

I have a git project. I just made a commit, then I deleted some directories. ops, my bad. Now I want to restore those directories that I have deleted. how do I do that?

+3  A: 

One way is to use git reset:

git reset --hard HEAD

This command will discard any working copy changes you have made since the last commit.

Greg Hewgill
+1: also, user281521, note that you can do "git log" and get the revision you want, and put that in place of "HEAD"
eruciform
Before try "git reset --hard HEAD", trough "git log" I try to checkout my latest revision, but nothing changes. when I run "git reset --hard HEAD", the project reverted to the revision BEFORE the HEAD, before the one I did just before delete the directories. And I got the message "HEAD is now at f3f34f3 bla" (bla was my revision).