title: Get GitHub git branch for AWS CodeBuild
body: <p>I'm setup AWS CodeBuild to build automatically from GitHub. Other CI services provide an environment variable for the branch, but I can't find one for AWS CodeBuild. There is a <code>CODEBUILD_SOURCE_VERSION</code> that is set to either <code>pr/7</code> where <code>7</code> is the pull request number or the git commit sha.</p>
  
  <p>Given the commit sha, I've been trying to get the branch name, but no luck so far.</p>
  
  <p><code>git branch --contains &lt;commitsha&gt;</code> doesn't work because it is a detached head. How do I get the git branch for the commit from CodeBuild?</p>