Reference Git branch start commit

柔情痞子 提交于 2019-12-28 04:03:15

问题


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 from svn repo.

This post just gives first commit of repo creation and not feature branch start commit.


回答1:


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)



来源:https://stackoverflow.com/questions/2458055/reference-git-branch-start-commit

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!