Skip to main content

The Anatomy of a Git Pull

Ever seen something like this?

➜  ~/projects/gitblit/[master]>git pull
remote: Counting objects: 5899, done.
remote: Compressing objects: 100% (1322/1322), done.
remote: Total 5746 (delta 4099), reused 5413 (delta 3770)
Receiving objects: 100% (5746/5746), 3.78 MiB | 853 KiB/s, done.
Resolving deltas: 100% (4099/4099), completed with 98 local objects.
From git://github.com/gitblit/gitblit
 * [new branch]      bootstrap  -> origin/bootstrap
 * [new branch]      gh-pages   -> origin/gh-pages
 * [new branch]      issues     -> origin/issues
 * [new branch]      ldap       -> origin/ldap
   8f73a7c..67d4f89  master     -> origin/master
 * [new branch]      rpc        -> origin/rpc
From git://github.com/gitblit/gitblit
 * [new tag]         v0.9.1     -> v0.9.1
 * [new tag]         v0.9.2     -> v0.9.2
 * [new tag]         v0.9.3     -> v0.9.3
Updating 8f73a7c..67d4f89
Fast-forward
 .classpath                                         |  137 +-
 .gitignore                                         |   43 +-
 NOTICE                                             |   56 +
 build.xml                                          |  484 ++-
 distrib/add-indexed-branch.cmd                     |   20 +
[..clipped..]
 docs/screenshots/00.png                            |  Bin 41019 -> 38869 bytes
 374 files changed, 43257 insertions(+), 3508 deletions(-)
 create mode 100644 distrib/add-indexed-branch.cmd
 create mode 100644 distrib/federation.properties
[..clipped..]

Well, David Gerber on the Git-user mailing list did, and asked what all this output is about. I realized it that I've built up a mental filter on the output of many Git commands, ignoring the parts which aren't important. So I wanted to dig in there, understand and explain each of those lines. Here's a slightly adapted copy of my answer on the mailing list. I'll update it if you have any comments that can improve on the explanations.

I've swapped his example output with what I got from doing a large update in the Gitblit project:


➜  ~/projects/gitblit/[master]>git pull remote: Counting objects: 5899, done.
Any message prefixed with "remote:" means it's coming from the remote repository.

The first thing it does it to count the number of objects in the repository that will have to be transferred: commits, blobs, trees and tags. 5899 is the number of objects missing in your local repository, I believe.

If you want to find out more about these objects, try playing around with git count-objects -v in your repositories, before and after committing. Also note how git gc modifies the result.

Note that the object count differs between "loose" objects, and objects that have been compressed into "pack files" (think of it as zip files) for efficiency.

remote: Compressing objects: 100% (1322/1322), done.
This is the remote compressing loose objects before transfer. I reckon 1322 is the number of loose objects that need to be transferred.

remote: Total 5746 (delta 4099), reused 5413 (delta 3770)
Now here I'm getting a bit unsure. Git does a lot of optimization on making the transfer as fast as possible. Some of the compressions it has done are delta-compressed, and I reckon that's what those delta objects are. I think reused means the contents that were already compressed into pack files on the remote side. Closest thing I could find to an explanation is here.

Receiving objects: 100% (5746/5746), 3.78 MiB | 853 KiB/s, done.
This is just a progress counter during the transfer across the wire. The final 38.50 is the number of Kibibytes (analog to Kilobytes) that was transferred.

Resolving deltas: 100% (4099/4099), completed with 98 local objects.
Just the receiving end confirming the deltas mentioned above.


From git://github.com/gitblit/gitblit
* [new branch] bootstrap -> origin/bootstrap
* [new branch] gh-pages -> origin/gh-pages
* [new branch] issues -> origin/issues
* [new branch] ldap -> origin/ldap
8f73a7c..67d4f89 master -> origin/master
* [new branch] rpc -> origin/rpc


This is a summary of the changes in the remote branches. Most of them are new, but you were already tracking the branch master, so it says from which version it was updated , and which it was updated to (from..to).



From git://github.com/gitblit/gitblit
* [new tag] v0.9.1 -> v0.9.1
* [new tag] v0.9.2 -> v0.9.2
* [new tag] v0.9.3 -> v0.9.3

Easy enough, these are the new tags that have been created.

Konstantin Khomoutov adds: Worth mentioning that only the tags attached to objects which are
referenced (directly or indirectly) by the head(s) being fetched (`git
pull` calls `git fetch` first) are downloaded by default. 
To get all the tags from the remote one can use `git fetch --tags ...`

Updating 8f73a7c..67d4f89
This is your current active branch (master) being updated with the changes we saw earlier. Since you are pulling, and not simply fetching, the changes from the remote branch are being merged into your local branch (because your local branch 'master' is set up to track the remote branch 'origin/master').

Fast-forward
This means that your local branch has not diverged from origin/master. In other words: you haven't made any local commits. The merge can therefore be fast-forwarded, playing the changes onto your local branch without doing a merge commit.

Note: This is an important line! If your pull was not a fast-forward, it means a merge commit has been created for you. If this is not intentional, you should consider undoing the merge (git reset --hard HEAD~1), and then doing git pull --rebase instead.

 .classpath                                         |  137 +-
 .gitignore                                         |   43 +-
 NOTICE                                             |   56 +
 build.xml                                          |  484 ++-
 distrib/add-indexed-branch.cmd                     |   20 +

These are the changes in "stat" form (lines added minus lines removed - same as doing git diff --stat 8f73a7c..67d4f89).

 docs/fed_aggregation.png        |  Bin 0 -> 21532 bytes
Change in a binary file, cannot be expressed as line changes, so the change in size is printed instead

 374 files changed, 43257 insertions(+), 3508 deletions(-)
A summary of the changes that were made in your local branch.

 create mode 100644 distrib/add-indexed-branch.cmd
 create mode 100644 distrib/federation.properties
[..clipped..]
This is a notice on which of the changes files are actually new files.

If you can elaborate any more on any of these, please do so in a comment, and I'll extend the post.

Comments

Popular posts from this blog

Open source CMS evaluations

I have now seen three more or less serious open source CMS reviews. First guy to hit the field was Matt Raible ( 1 2 3 4 ), ending up with Drupal , Joomla , Magnolia , OpenCms and MeshCMS being runner-ups. Then there is OpenAdvantage that tries out a handful ( Drupal , Exponent CMS , Lenya , Mambo , and Silva ), including Plone which they use for their own site (funny/annoying that the entire site has no RSS-feeds, nor is it possible to comment on the articles), following Matt's approach by exluding many CMS that seem not to fit the criteria. It is somewhat strange that OpenAdvantage cuts away Magnolia because it "Requires J2EE server; difficult to install and configure; more of a framework than CMS", and proceed to include Apache Lenya in the full evaluation. Magnolia does not require a J2EE server. It runs on Tomcat just like Lenya does (maybe it's an idea to bundle Magnolia with Jetty to make it seem more lightweight). I'm still sure that OpenAdvant

Considerations for JavaScript in Modern (2013) Java/Maven Projects

Disclaimer: I'm a Java developer, not a JavaScript developer. This is just what I've picked up the last years plus a little research the last days. It's just a snapshot of my current knowledge and opinions on the day of writing, apt to change over the next weeks/months. We've gone all modern in our web applications, doing MVC on the client side with AngularJS or Ember , building single-page webapps with REST backends. But how are we managing the growing amount of JavaScript in our application? Yeoman 's logo (not necessarily the conclusion of this blog post) You ain't in Kansas anymore So far we've just been doing half-random stuff. We download some version of a library and throw it into our src/main/webapp/js/lib , or we use it from a CDN , which may be down or unreachable when we want to use the application.. Some times the JS is minified, other times it's not. Some times we name the file with version number, other times without. Some

Git Stash Blooper (Could not restore untracked files from stash)

The other day I accidentally did a git stash -a , which means it stashes *everything*, including ignored output files (target, build, classes, etc). Ooooops.. What I meant to do was git stash -u , meaning stash modifications plus untracked new files. Anyhows, I ended up with a big fat stash I couldn't get back out. Each time I tried, I got something like this: .../target/temp/dozer.jar already exists, no checkout .../target/temp/core.jar already exists, no checkout .../target/temp/joda-time.jar already exists, no checkout .../target/foo.war already exists, no checkout Could not restore untracked files from stash No matter how I tried checking out different revisions (like the one where I actually made the stash), or using --force, I got the same error. Now these were one of those "keep cool for a second, there's a git way to fix this"situation. I figured: A stash is basically a commit. If we look at my recent commits using   git log --graph --

Managing dot-files with vcsh and myrepos

Say I want to get my dot-files out on a new computer. Here's what I do: # install vcsh & myrepos via apt/brew/etc vcsh clone https://github.com/tfnico/config-mr.git mr mr update Done! All dot-files are ready to use and in place. No deploy command, no linking up symlinks to the files . No checking/out in my entire home directory as a Git repository. Yet, all my dot-files are neatly kept in fine-grained repositories, and any changes I make are immediately ready to be committed: config-atom.git     -> ~/.atom/* config-mr.git     -> ~/.mrconfig     -> ~/.config/mr/* config-tmuxinator.git       -> ~/.tmuxinator/* config-vim.git     -> ~/.vimrc     -> ~/.vim/* config-bin.git        -> ~/bin/* config-git.git               -> ~/.gitconfig config-tmux.git       -> ~/.tmux.conf     config-zsh.git     -> ~/.zshrc How can this be? The key here is to use vcsh to keep track of your dot-files, and its partner myrepos/mr for o

Leaving eyeo

Thirteen blog posts later, this one notes my departure from eyeo after 4 years and 3 months. I joined eyeo around the headcount of 80 employees, and now I think there's just over 250 people there. My role coming in was as operations manager, doing a mix of infrastructure engineering and technical project management. I later on took on organizational development to help the company deal with its growing pains . We introduced cross-functional teams, departments (kind of like guilds), new leadership structures, goal-setting frameworks, onboarding processes and career frameworks.  And all of this in a rapidly growing distributed company. I'm proud and happy that for a long time I knew every employee by name and got to meet every single new-hire through training them on company structure and processes.  At some point, we had enough experienced leaders and organizational developers that I could zoom back in on working in one team, consulting them on  Git and continuous integration