Git - 如何找到特定分支的第一次提交 [英] Git - how to find first commit of specific branch

查看:173
本文介绍了Git - 如何找到特定分支的第一次提交的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



  ABCDE(主分支)
\
FGH(xxx分支)

我正在寻找F - xxx分支中的第一个提交。我认为这是可能的:

  git log xxx --not master 

最后列出的提交应该是F.它是正确的解决方案,还是可能存在一些缺点?



我知道在stackoverflow上有类似的问题,但没有人提出这样的解决方案,我不知道我是否正确。

解决方案

  git log master..branch --oneline | tail -1 

dot-dot为您提供分支拥有的所有提交有。 tail -1 会返回前一个输出的最后一行。


In following example tree:

A-B-C-D-E (master branch)
    \
     F-G-H (xxx branch)

I'm looking for F - the first commit in xxx branch. I think that it is possible with:

git log xxx --not master

and the last listed commit should be F. Is it correct solution or maybe there are some disadvantages of it?

I know that there were similar questions on stackoverflow, but nobody proposed such solution, and I'm not sure if I do it right.

解决方案

git log master..branch --oneline | tail -1

dot-dot gives you all of the commits that the branch has that master doesn't have. tail -1 returns the last line from the previous output.

这篇关于Git - 如何找到特定分支的第一次提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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