使用--depth = 1克隆时,查找Git仓库中的提交数量

时间:2015-08-18 09:56:09

标签: git

要查找git分支上的提交数量,您可以执行以下操作:

$ git rev-list --count HEAD
920

但是,如果您最初使用--depth=1进行克隆,则无效:

$ git clone https://github.com/ndmitchell/hoogle.git --depth=1
$ cd hoogle
$ git rev-list --count HEAD
1

有没有办法获得--depth=1克隆的速度和减少的网络流量,但是还能获得提交次数的计数?

1 个答案:

答案 0 :(得分:3)

  

有没有办法获得--depth = 1克隆的速度和减少的网络流量,但是还能获得提交次数的计数?

我很确定你不能。

如您所知,<jmapper> <class name="package.RequestD"> <attribute name="language"> <value name="language"/> </attribute> </class> </jmapper> 仅检索最近推送的提交。这意味着当你以1的深度克隆时,你得到1次提交,只有那次提交,没有任何历史记录附加到它。

就本地存储库而言,没有历史记录,只有这一次提交。

正如the docs

中所述
  

- 深度

     

创建一个浅层克隆,其历史记录被截断为指定数量的修订

即使您检查原点

,我也觉得有趣
SELECT
max(a.salary) as salary
FROM
tbl_emp as a,
tbl_emp as b
WHERE
a.salary < b.salary
and a.dept_Id = '57'
and a.Date_of_joining between '2015-01-01 00:00:00' and '2015-01-01 23:59:59';

他们俩都只显示1次提交。