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

前端 未结 3 1800
梦如初夏
梦如初夏 2021-01-30 20:54

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 syst

3条回答
  •  抹茶落季
    2021-01-30 21:44

    You can ask git branch directly which branches contain the commit in question:

    % git branch -a --contains 4f08c85ad
    * master
      remotes/origin/bug_872
      remotes/origin/bug_898
      remotes/origin/master
    

提交回复
热议问题