Git:“git fetch”报告的数字是什么意思?

发布于 2024-12-10 08:14:27 字数 443 浏览 0 评论 0原文

运行 git fetch 时,会给出一些数字:

$ git fetch upstream
remote: Counting objects: 77, done.
remote: Compressing objects: 100% (23/23), done.
remote: Total 47 (delta 19), reused 39 (delta 11)
Unpacking objects: 100% (47/47), done.
From http://github.com/jbossas/jboss-as
ef19bd4..b5015c1  master     -> upstream/master

它们有什么用处吗?我想知道例如在该远程中发生了多少次提交。这些数据似乎不包含其中(在本例中为 5 次提交)。
(我知道我可以看到日志或其他任何东西;只是想知道那是做什么用的。)

When running git fetch, that gives some numbers:

$ git fetch upstream
remote: Counting objects: 77, done.
remote: Compressing objects: 100% (23/23), done.
remote: Total 47 (delta 19), reused 39 (delta 11)
Unpacking objects: 100% (47/47), done.
From http://github.com/jbossas/jboss-as
ef19bd4..b5015c1  master     -> upstream/master

Are they useful in any way? I'd like to know e.g. how many commits was fetched happened in that remote. Which seems not to be contained in these data (in this case, it was 5 commits).
(I know I can see log or whatever to see that; just wonder what's that for.)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

于我来说 2024-12-17 08:14:27

这是要获取(或必须获取)的对象数量。对象可以是以下任何内容:blobtreecommittag

因此,最简单的提交将由 2 个对象组成:commit 对象和(空)tree 对象。添加一个文件,你就得到了三个对象:commit+tree+blob。

要对获取的提交进行计数,请使用 git rev-list 来解析提交范围 ef19bd4..b5015c1:

git rev-list | wc -l

It's how many objects are going to be fetched (or had to be fetched). An object can be anything of: blob, tree, commit or tag.

So, the most simplest commit would be composed of 2 objects: The commit object and the (empty) tree object. Add one file, and you've got three objects: commit+tree+blob.

To count the fetched commits, use git rev-list to parse the commit range ef19bd4..b5015c1:

git rev-list | wc -l
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文