Finding what branch a Git commit came from

后端 未结 14 2545
失恋的感觉
失恋的感觉 2020-11-22 10:43

Is there a way to find out what branch a commit comes from given its SHA-1 hash value?

Bonus points if you can tell me how to accomplish this using Ruby Grit.

14条回答
  •  时光取名叫无心
    2020-11-22 11:18

    khichar.anil covered most of this in his answer.

    I am just adding the flag that will remove the tags from the revision names list. This gives us:

    git name-rev --name-only --exclude=tags/* $SHA
    

提交回复
热议问题