DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
11 Monitoring and Observability Tools for 2023
Learn more
  1. DZone
  2. Testing, Deployment, and Maintenance
  3. Deployment
  4. The Anatomy of a Git Pull

The Anatomy of a Git Pull

Thomas Ferris Nicolaisen user avatar by
Thomas Ferris Nicolaisen
·
Jul. 06, 12 · Interview
Like (0)
Save
Tweet
Share
4.67K Views

Join the DZone community and get the full member experience.

Join For Free
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.
Git Branch (computer science) Object (computer science) remote

Published at DZone with permission of Thomas Ferris Nicolaisen. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Important Data Structures and Algorithms for Data Engineers
  • Java REST API Frameworks
  • DevOps vs Agile: Which Approach Will Win the Battle for Efficiency?
  • How To Handle Secrets in Docker

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: