git如何找到提交哈希分支源于哪里 [英] git how to find commit hash where branch originated from

查看:165
本文介绍了git如何找到提交哈希分支源于哪里的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假装我从主分支分支到主题分支,然后我在主题分支上做了一些提交。有没有一个命令告诉我在主分支上提交我的主题分支源自的散列?



理想情况下,我不必知道我有多少提交, (试图避免HEAD ^ 5)。

我已经搜索了Google,并且似乎无法找到答案。感谢!

解决方案使用 git merge-base master your-branch to找到两个分支(通常是分支点)之间最好的共同祖先。


Pretend I branched from my master branch to a topic branch, and then I did a few commits on my topic branch. Is there a command that tells me the commit hash on the master branch that my topic branch originated from?

Ideally, I wouldn't have to know how many commits I've made ( trying to avoid HEAD^5 ).

I've googled and SO'd around and can't seem to land on the answer. Thanks!

解决方案

use git merge-base master your-branch to find the best common ancestor between two branches (usually the branching point).

这篇关于git如何找到提交哈希分支源于哪里的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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