Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
322 views
in Technique[技术] by (71.8m points)

When I do "git push", what do the statistics mean? (Total, delta, etc.)

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.

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"?

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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
...
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 objects being counted for that specific commit. Pretty much everything in git is an object, and are basically blobs saved in your .git/objects folder under their respective hash. More info in the man pages : 9.2 Git Internals - Git Objects.

Compressing objects: 100% (14/14), done.

This is git compressing the objects before send. The 14/14 is the progression in KiB of the compression (14 KiB to compress).

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/s is the progression in KiB and the speed (0 bytes/s when finished).

Total 14 (delta 10), reused 0 (delta 0)

This is the output of the packfile algorithm 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 0 part). The delta 0 part is the gain in KiB from the packing or from the reuse.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...