git仓库中的提交数量 [英] Number of commits in a git repository

查看:117
本文介绍了git仓库中的提交数量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一个5个月的项目已经接近尾声,并且作为无意义统计的粉丝,

我想知道自从仓库开始以来有多少次提交。



我如何发现这一点?



注意:


  1. 我知道没有一个 存储库,我只对本地版本感兴趣。

  2. p>这在Subversion中是微不足道的,因为修订标识符
    似乎是提交编号。 >解决方案

获取当前分支的提交数量:

 
git log --pretty = oneline | wc -l

要获得更完整的计数,请使用:

 
git rev-list --all | wc -l

有关指定要计数的对象的详细信息,请参阅git rev-list的文档。



很容易尝试这样的事情:

 
find .git / objects -type f | wc -l

但这不会计算打包对象。最好坚持使用git rev-list。

A 5 month project of mine is nearing its end and as a fan of pointless statistics,
I'd like to know how many commits have been made since the repository's inception.

How do I find that out?

Notes:

  1. I know there is no one repository, I'm just interested in the local version.

  2. This is trivial in subversion, as the revision identifier seems to be the commit number.

解决方案

To get the number of commits on the current branch:

git log --pretty=oneline | wc -l

For a more complete count, use:

git rev-list --all | wc -l

See the docmentation for git rev-list for details on specifying objects to count.

It is tempting to try something like:

find .git/objects -type f | wc -l

but this will not count packed objects. It's best to stick with git rev-list.

这篇关于git仓库中的提交数量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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