引用Git分支开始提交 [英] Reference Git branch start commit

查看:134
本文介绍了引用Git分支开始提交的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图找到如何从脚本引用分支开始提交。我的意思是分支分支处的提交。



此外,我期望它可以用于由svn repo制作的历史记录。



这篇文章只是第一次提交repo创建,而不是功能分支开始提交。

解决方案

您正在寻找的是命令合并-base

  git merge-base master feature-branch 

将打印这两个分支的最佳共同祖先,即它们分开的地方。 (文档有漂亮的图片澄清一些有趣的案例)

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.

解决方案

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)

这篇关于引用Git分支开始提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆