title: What's the proper way for a script to get the first line of a commit message for a particular symbolic reference in Git?
body: <p>I'm looking to get the first line of the commit message for the commit referred by a symbolic reference like <code>HEAD</code> or <code>master</code>.</p>
  
  <p>This is needed within a script that has to function reliably regardless of environment or git configuration.</p>
  
  <p>I know there's:</p>
  
  <pre><code>git log -1 --pretty=%s
  </code></pre>
  
  <p>But <code>git-log</code> is porcelain and IIRC it's not allowed to use porcelain in scripts. More specifically, I suspect its output can be modified by configurations such as <code>~/.gitconfig</code>, so it's not reliable across environments.</p>