Git for Data: Pointers, Chunks and Versioned Object Stores

By Edward Grundy, Bay Information Systems. Published . In Data Strategy.

When Hugging Face acquired XetHub in August 2024, it held about 12PB of files in Git LFS, spread across 280 million files, and 7.3TB in git itself.

That proportion is typical of machine learning work, and it explains a crowded field of tools: Git LFS, git-annex, DVC, Xet, lakeFS, Apache Iceberg and Dolt, among others. Each is described as version control for data. Underneath, all of them keep the design set out in our git deep dive: content named by hash, with a small set of mutable names and snapshot over the top. For data storage, the unit of data that gets hashed: a whole file, a chunk of a file, an object in a bucket, a node of a database index and where the data is stored are important.

In this article, We set out why git itself handles data badly, then take the tools in order of the unit they hash, and finish with a comparison table.

Does git handle data badly?

Two properties that make git good for text and poor for data: A clone receives every version of every file, so a 1GB file committed in ten versions puts up to 10GB into every copy of the repository, whether or not anyone needs the old versions. Second, git saves space by storing similar objects as differences against each other, which works well for text but poorly for binary or formats which rewrite entire files on save. Compressed images, Parquet files and model weights change almost entirely on each save - sometimes without any change in contents. So each version is stored more or less whole.

The fix every “git-for-data” tool adopts is to adjust the git storage layer.

Indirection

The first generation of tools replaces each large file in the repository with a small pointer, and keeps the file itself in a separate store keyed by hash.

Git LFS, announced by GitHub in April 2015, is the most widely used. A tracked file is committed as a three-line text file giving the specification version, the SHA-256 hash of the content and its size. Git’s filter mechanism swaps pointer and content automatically: on adding a file, LFS uploads the content and commits the pointer, and on checking out, it fetches content by hash from an LFS server over HTTPS. Only the versions a checkout needs are downloaded.

git-annex, written by Joey Hess and released in 2010, predates LFS and does more. Each annexed file is committed as a symbolic link to a key derived from the file’s hash, and a separate branch in the repository records which locations hold a copy of each object. Those locations can be other clones, S3 buckets, SSH servers or one of many other storage back ends.

DVC, started by Dmitry Petrov in 2017 and taken over by lakeFS from Iterative in November 2025, is aimed at machine learning projects. Tracking a dataset writes a small .dvc file holding the content’s MD5 hash and moves the data into a local cache at a path built from that hash (.dvc/cache/files/md5/ec/1d2935f8...). A tracked directory gets a manifest listing the hash of each file inside it, which is a git directory listing under another name. Remotes on S3, Google Cloud Storage, Azure, SSH and other stores hold the shared copy, and DVC adds pipelines that record which data and code produced which outputs.

All three move git’s own design one level out. The repository holds names and hashes; an external store holds immutable content under those hashes. They share one weakness: because the file is the unit of storage, a corrected row in a 2GB CSV costs another 2GB of storage and transfer.

Chunks: hashing parts of files

Content-defined chunking slides a window over the bytes of the file, and a boundary is placed wherever the hash meets some condition, so boundaries are decided by the content around them. An insertion changes the chunk it lands in and leaves other boundaries unchanged. Each chunk is then stored under its own hash, and identical chunks are stored once, across versions, files and repositories.

Xet, the system Hugging Face bought with XetHub, applies this to the Hub. Files are cut into chunks of about 64KB, chunks are grouped into larger containers for storage and transfer, and every chunk, container and file is addressed by hash. Repositories keep pointer files in the LFS format, so existing clients still work, and a bridge serves LFS requests from Xet storage. Hugging Face began moving repositories in January 2025; by July, 500,000 repositories holding 20PB had moved. XetHub’s earlier benchmarks against Git LFS showed storage and transfer costs about halved for datasets edited in small increments.

The same technique has long run inside backup tools such as restic and Borg (see What Is an Object Store? for more).

Versioning the object store

Pointer tools copy data into their own stores. A data lake already lives in object storage, read by Spark, Trino or DuckDB at its own paths. Copying it into a separate cache defeats the purpose.

lakeFS puts a git-like layer over a bucket. Objects written through it are never modified, and several paths in different commits can map to the same underlying object. A commit is an immutable, sorted list of paths and the objects they point to, stored in the object store as SSTable files arranged as a tree, so a new commit rewrites only the parts of the list that changed. A branch is a pointer to a commit plus a set of uncommitted changes, which makes creating a branch of a petabyte lake a metadata operation.

Apache Iceberg applies the same structure to a single table. Data files are immutable, and a tree of metadata files lists which data files make up each snapshot of the table, reusing as much of the previous snapshot’s tree as possible. A write produces new data files and a new top-level metadata file, then commits by asking a catalogue to swap its pointer from the old metadata file to the new.

Versioning rows

Dolt applies the design inside a database. It speaks MySQL’s dialect (sister projects put PostgreSQL and SQLite front ends on the same storage) and stores each table in a prolly tree, a structure from the earlier Noms project. A prolly tree is a B-tree in which node boundaries are chosen by the content of the keys, in the same way as content-defined chunking, and every node is stored under its hash. Two versions of a table share every subtree that did not change, and a diff between versions skips shared subtrees without reading them, as git does with directory listings. The roots of those trees go into a commit graph, so branches, merges and history are available through SQL.

Two choices, seven tools

Tool Unit hashed Where the bytes live Where the names live
Git LFS Whole file (SHA-256) LFS server Pointer files in git
git-annex Whole file (usually SHA-256) Any of many remotes Symbolic links and a branch in git
DVC Whole file (MD5), plus directory manifests Local cache and a remote such as S3 .dvc files in git
Xet Content-defined chunks of about 64KB Hugging Face’s chunk store LFS-format pointers in git
lakeFS Object in the bucket The existing object store lakeFS commits and branches
Apache Iceberg Data file The existing object store A catalogue’s pointer to the current metadata
Dolt Tree node Dolt’s own block store Dolt’s commit graph

We can sort a project’s needs with these two questions: How large are the units that change? relative to the files that hold them. Model weights that are replaced whole suit any of the pointer tools; datasets corrected a few rows at a time favour chunking, or a table format; records edited by people favour a versioned database. Does the data have to stay where other systems read it? Data that travels with the code, to a laptop or a training job, suits pointers in a git repository. Data that lives in a lake and is read in place belongs with lakeFS or Iceberg.

Whichever tool fits, the habit that pays most is recording the hash. A training run that logs the hash of its dataset, or the commit of its data repository, can be reproduced exactly years later, and the question of which data produced a model has an answer that does not depend on anyone’s memory. (For a review of how a project’s data is stored and versioned, get in touch; the data maturity checklist is a quicker start.)

References

Opening

Does git handle data badly?

Indirection

Chunks: hashing parts of files

Versioning the object store

Versioning rows


(Checklist: Data Maturity Checklist. Fourteen questions on storage, third-party services, reproducibility, ownership, governance and use, with guidance on each answer.)

Questions about this? Get in touch.