title: Recovering broken git repository
body: <p>My working git repository is broken, it lose track to all the files in it, i.e.</p>
  
  <pre>
  $ git log
  fatal: bad default revision 'HEAD'  
  </pre>
  
  <pre>
  $ git status  
  ... told me that all the files are new
  </pre>
  
  <p>However the .git directory does contain my objects.</p>
  
  <pre>
  $ du -sh .git
  34M    .git
  </pre>
  
  <pre>
  $ git count-objects
  4151 objects, 32692 kilobytes
  </pre>
  
  <pre>
  $ git --version
  git version 1.6.0.4
  </pre>
  
  <p>The last thing I remember doing before it went wrong was creating (clone --mirror) a backup repository at an NFS-mounted server. However the backup repository cloned is broken the same way.</p>
  
  <p>How can I restore my repository?</p>