Finding what branch a Git commit came from

后端 未结 14 2560
失恋的感觉
失恋的感觉 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:16

    As an experiment, I made a post-commit hook that stores information about the currently checked out branch in the commit metadata. I also slightly modified gitk to show that information.

    You can check it out here: https://github.com/pajp/branch-info-commits

提交回复
热议问题