title: Why does git show-ref --hash -- HEAD show a different sha1 than HEAD?
body: <p>I'm going to use git rev-parse instead, but I am curious as to why the following command is giving me a different commit ID than I expect.</p>
  
  <p>I wanted to pull the sha1 from HEAD in some scripts I'm writing. I was playing around with show-ref and rev-parse for this. What's curious to me is that using show-ref on HEAD shows a completely different sha1 than what is actually at HEAD. Using git rev-parse does not have this issue. Consider the following:</p>
  
  <pre><code>&gt; git show-ref --hash -- HEAD
  40f3fb3d84b7c9857cadb581b901e3cc20ed1f24
  &gt; git rev-parse HEAD
  a54b2714e6052ba063ea45924610e2cf0b6e5750
  </code></pre>
  
  <p>It seems the two above statements should return the same commit ID. Why is there the difference?</p>