title: Find the hash of a file in Git history
body: <p>I try to find the hash of a file at a given point in the history.</p>
  
  <pre><code>git ls-files $REVISION $PATH | \
    sed -n 's/^.\{6\} .\+ \([0-9a-f]\{40\}\)\t.*$/\1/p'
  </code></pre>
  
  <p>works, but it looks rather inelegant. It displays mode, type, hash and path to then use <code>sed</code> to filter out only the hash. Is there some command that only prints the hash to begin with?</p>
  
  <p>I imagine to have overlooked something more straightforward like <code>git show --pretty=%hash $REVISION:$PATH</code>. Does a Git command like this exist?</p>