Question

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.

Was it helpful?

Solution

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.

OTHER TIPS

Git is a content addressable file system. i.e., it takes an object(file, tree, commit) and stores it in files addressable by hashes.

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.

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.

Now coming to your question:

Counting objects: 22, done.: Git is counting the object related to your commits which you are pushing.

Total 14 (delta 10): Git was able to reduce the number of objects by finding 10 deltas.

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.

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.

Hope this helps.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top