title: fatal: Failed to resolve HEAD as a valid ref
body: <p>I am getting fatal: Failed to resolve HEAD as a valid ref. whenever I try to commit.</p>
  
  <p>I have tried </p>
  
  <pre><code>echo ref: refs/heads/master &gt;.git/HEAD
  </code></pre>
  
  <p>but its not working</p>
  
  <p>Also tried</p>
  
  <pre><code>git commit
  </code></pre>
  
  <p>its not working either from below sources</p>
  
  <p><a href="https://stackoverflow.com/questions/4848607/git-fatal-no-such-ref-head">Git &#39;fatal: No such ref: HEAD&#39;</a>
  <a href="https://stackoverflow.com/questions/19116545/git-tag-fatal-failed-to-resolve-head-as-a-valid-ref">git tag: fatal: Failed to resolve &#39;HEAD&#39; as a valid ref</a></p>
  
  <p>Please help in..All my commit history is also gone</p>