问题描述
我有branch1
和branch2
,我想要某种类型的东西:
I have branch1
and branch2
and I want some sort of:
git branch1 isahead branch2
这将显示branch1
是否具有branch2
不具有的提交(并可能也指定那些提交).我无法检查导致branch2
是否在branch1
之前的(具有branch1没有的提交).
That will show if branch1
has commits that branch2
doesn't have (and possibly specify those commits too). I can't check diff cause branch2
is ahead of branch1
(has commits that branch1 doesn't have).
有办法吗?我浏览了git diff
却找不到任何东西
Is there a way? I looked through git diff
and couldn't find anything
推荐答案
您可以使用
git log branch2..branch1
如果branch1
在branch2
之前没有提交,则输出为空.
If branch1
has no commit ahead of branch2
, output will be empty.
您也可以使用git rev-list --count branch2..branch1
这将显示前面的提交次数
This will show the number of commits ahead
这篇关于使用脚本检查git分支是否在另一个分支之前的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!