This happened when working with git on Ruby on Rails. several commits and branches were done and created.
git version 1.7.3.4
I accidentall
You can clone your repository to another location and simply copy the cloned .git folder to the place of your deleted .git folder.
.git