Search this blog...

git gc, loose and packed git objects

Intro:
Recently during lunch, a bunch of us started discussing git internals. One popular point of contention that came-up was how git stores the incremental changes internally?

The Question:
Does the .git subdirectory contain:
- compressed diffs that apply on the original version of each file?
    OR
- compressed copy of each version of each modified file?
The Answer:
Different blogs appeared to claim differently [1] [2], and we were too lazy to go look-up the definitive source - the source-code of git.

Warning: The following video is processed in a facility that also processes nuts.
 Contains traces of the 60's Batman TV show.


The Conclusion:

Another mystery solved. git gc to the rescue...

References:
[1] https://codewords.recurse.com/issues/two/git-from-the-inside-out
[2] https://schacon.github.io/gitbook/1_the_git_object_model.html
[3] https://schacon.github.io/gitbook/7_how_git_stores_objects.html
[4] https://schacon.github.io/gitbook/7_the_packfile.html

Meanwhile... having solved the riddle,
the caped-crusader and the wonder-boy went to Gotham city's garbage collection facility
in the Bat-mobile to foil whatever plan the Riddler's hatching...

No comments :

Post a Comment