Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git: What do the numbers reported by `git fetch` mean?

Tags:

git

git-fetch

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.)

like image 668
Ondra Žižka Avatar asked Oct 17 '11 11:10

Ondra Žižka


1 Answers

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
like image 158
knittl Avatar answered Oct 12 '22 00:10

knittl