How can I determine if a given git hash exists on a given branch?

Posted by pinko on Stack Overflow See other posts from Stack Overflow or by pinko
Published on 2010-03-14T22:39:47Z Indexed on 2010/03/14 22:45 UTC
Read the original article Hit count: 121

Filed under:

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.

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.

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?

© Stack Overflow or respective owner

Related posts about git