title: How can I determine if a given git hash exists on a given branch?
body: <p>Background: I use an automated build system which takes a git hash as input, as well as the name of the branch on which that hash exists, and builds it.  However, the build system uses the hash alone to check out the code and build it -- it simply stores the branch name, as given, in the build DB metadata.</p>
  
  <p>I'm worried about developers accidentally providing the wrong branch name when they kick off a build, causing confusion when people are looking through the build history.</p>
  
  <p>So how can I confirm, before passing along the hash and branch name to the build system, that the given hash does in fact come from the given branch?</p>