当我执行“git push”时,统计数据是什么意思?(总计、增量等)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21476167/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
When I do "git push", what do the statistics mean? (Total, delta, etc.)
提问by SerMetAla
Here is an example:
下面是一个例子:
$ git push -u myserver master
Counting objects: 22, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (14/14), done.
Writing objects: 100% (14/14), 1.89 KiB | 0 bytes/s, done.
Total 14 (delta 10), reused 0 (delta 0)
To myserver.com:git/myrepo.git
ed46414..0cae272 master -> master
Branch master set up to track remote branch master from myserver.
Basically the only number above that makes any sense to me is the 8 in "using up to 8 threads", because I have a quad-core processor with hyperthreading, therefore I can run 8 threads.
基本上,上面唯一对我有意义的数字是“最多使用 8 个线程”中的 8,因为我有一个带超线程的四核处理器,因此我可以运行 8 个线程。
What are there 22 of? Why does it say 22 and then 14, what happened to the other 8? Why does it say 0 bytes/s, given that it did stuff and took finite time? What is "total" and "delta" and "reused"?
什么是22?为什么它说 22 然后是 14,其他 8 发生了什么?考虑到它做了一些事情并且花费了有限的时间,为什么它说 0 bytes/s?什么是“总计”、“增量”和“重用”?
Details about the example:The example above is copy-pasted from Terminal on Mac OS X. I manually did a find-replace to substitute in "myrepo" and "myserver.com", everything else is verbatim. The repository has 910 commits, and I made about 3 commits since the prior push. The 3 new commits affected at least 3 files. The repo contains over a thousand files.
有关示例的详细信息:上面的示例是从 Mac OS X 上的终端复制粘贴的。我手动进行了查找替换以替换“myrepo”和“myserver.com”,其他一切都是逐字逐句的。存储库有 910 次提交,自上次推送以来我进行了大约 3 次提交。3 个新提交至少影响了 3 个文件。该 repo 包含一千多个文件。
回答by Alexandre DuBreuil
Short answer
简答
This is merely the output of the git command git count-objects -v
for the push (the same command is called for output when gc
, pull
and clone
). More info in the man pages : git-count-objects(1).
这只是git count-objects -v
用于推送的 git 命令的输出(在gc
,pull
和时调用相同的命令进行输出clone
)。手册页中的更多信息:git-count-objects(1)。
$ git count-objects -v
...
size: 14 # The "Compressing objects: 100% (14/14)" part (the size in KiB)
in-pack: 22 # The "Counting objects: 22" part (the number of objects)
...
Long answer
长答案
Counting objects: 22, done.
This is git 22 internal objectsbeing counted for that specific commit. Pretty much everything in git is an object, and are basically blobs saved in your .git/objectsfolder under their respective hash. More info in the man pages : 9.2 Git Internals - Git Objects.
这是为该特定提交计数的git 22 内部对象。git 中的几乎所有东西都是一个对象,基本上是保存在.git/objects文件夹中各自哈希下的blob 。手册页中的更多信息:9.2 Git Internals - Git Objects。
Compressing objects: 100% (14/14), done.
This is git compressing the objects before send. The 14/14is the progression in KiB of the compression (14 KiB to compress).
这是 git 在发送之前压缩对象。的14/14处于压缩的KIB(14 KIB到压缩)的进展。
Writing objects: 100% (14/14), 1.89 KiB | 0 bytes/s, done.
This is git sending (if remote) and writing the objects. The 1.89 KiB | 0 bytes/sis the progression in KiB and the speed (0 bytes/s when finished).
这是 git 发送(如果远程)和写入对象。在1.89昆明植物研究所| 0 字节/秒是以 KiB 为单位的进度和速度(完成时为 0 字节/秒)。
Total 14 (delta 10), reused 0 (delta 0)
This is the output of the packfilealgorithm in git (see 9.4 Git Internals - Packfiles) and is fairly obscure. It basically packs the unused objects, typically older history, in .git/objects/pack. After packing, git checks if it can reuse packs (hence the reused 0part). The delta 0part is the gain in KiB from the packing or from the reuse.
这是git 中packfile算法的输出(请参阅9.4 Git Internals - Packfiles)并且相当晦涩。它基本上将未使用的对象(通常是较旧的历史记录)打包在.git/objects/pack 中。打包后,git 检查它是否可以重用包(因此是重用的 0部分)。的增量0的部分是从包装或从重用KIB增益。
回答by Akash Agrawal
Git is a content addressable file system. i.e., it takes an object(file, tree, commit) and stores it in files addressable by hashes.
Git 是一个内容可寻址的文件系统。即,它接受一个对象(文件、树、提交)并将其存储在可通过哈希寻址的文件中。
Suppose you make a very small change in the file. Should git store the full file as a different object? Well it does. But occasionally(during push, pull), git computes file changes as deltas and store them instead of full files.
假设您对文件进行了很小的更改。git 应该将完整文件存储为不同的对象吗?嗯,确实如此。但偶尔(在推、拉期间),git 将文件更改计算为增量并存储它们而不是完整文件。
That means, the most recent version of file is stored in full (since it should be available most readily), older version of the same file is just an object containing the difference between the two and so on.
这意味着,文件的最新版本被完整存储(因为它应该最容易获得),同一文件的旧版本只是一个包含两者之间差异的对象,依此类推。
This way git saves space while still able to reconstruct the file for any revision you throw at it.
这样 git 节省了空间,同时仍然能够为您抛出的任何修订重建文件。
Now coming to your question:
现在来回答你的问题:
Counting objects: 22, done.
: Git is counting the object related to your commits which you are pushing.
Counting objects: 22, done.
:Git 正在计算与您正在推送的提交相关的对象。
Total 14 (delta 10)
: Git was able to reduce the number of objects by finding 10 deltas.
Total 14 (delta 10)
:Git 能够通过找到 10 个增量来减少对象的数量。
reused 0 (delta 0)
: Git can reuse the delta objects if same exists already. For example if the similar changes might have been introduced in some other file, the delta may be similar and reusable. Here, there was nothing to reuse.
reused 0 (delta 0)
:如果增量对象已经存在,Git 可以重用它。例如,如果在其他文件中可能引入了类似的更改,则增量可能是类似的并且可重用。在这里,没有什么可以重用的。
Writing objects: 100% (14/14), 1.89 KiB | 0 bytes/s, done.
Here Git is sending (or writing) the objects over the network, and you can see progress and speed statistics as it's doing that.
Writing objects: 100% (14/14), 1.89 KiB | 0 bytes/s, done.
在这里,Git 通过网络发送(或写入)对象,您可以在执行此操作时查看进度和速度统计信息。
Hope this helps.
希望这可以帮助。