What is the difference between a loose object and a packfile, and why does Git pack objects?

Last updated 6 July 2026

  • A loose object is one zlib-compressed file per object in .git/objects/: fast to write, but stored in full with no sharing.

  • A packfile (.pack plus .idx index) bundles many objects and delta-compresses similar ones as diffs against a base.

  • Packing saves disk and I/O, and push/fetch transfer packfiles. It happens via git gc or git repack.

  • https://gitperf.com/chapter-06.html
  • https://www.graphapp.ai/engineering-glossary/git/git-loose-objects
  • https://dev.to/calebsander/git-internals-part-2-packfiles-1jg8
  • https://mastercraft.hashnode.dev/demystifying-git-object-packs-and-managing-repository-size
  • https://rahulsuryawanshi.com/cloud-devsecops/advanced-git-internals-how-git-scales-to-massive-repositories/
  • https://github.com/cirosantilli/git-tutorial/blob/master/packfiles.md
  • https://www.arthrop0d.com/articles/git-packfiles-delta-compression.html
  • https://webcodingcenter.com/git/the-object-model-under-the-hood--packfiles-delta-compression-and-loose-objects.html
All Git interview questions