Reference Git branch start commit

后端 未结 1 878
猫巷女王i
猫巷女王i 2020-12-03 10:52

I am trying to find how to reference branch start commit from script. I mean the commit sha at which branch was forked.

Moreover I expect it work for history made fr

相关标签:
1条回答
  • 2020-12-03 11:26

    What you're looking for is the command merge-base:

    git merge-base master feature-branch
    

    will print the best common ancestor of those two branches, i.e. where they forked apart. (The documentation has pretty pretty pictures to clarify some of the interesting cases)

    0 讨论(0)
提交回复
热议问题