Back to articles
Your Branch Is 41 Bytes (Git Internals Explained)
NewsTools

Your Branch Is 41 Bytes (Git Internals Explained)

via Dev.toNeural Download

https://www.youtube.com/watch?v=wn7jXAFhgzY You've used Git almost every day of your career. git add , git commit , git push . But in a poll of experienced developers, 51% said Git stores the differences between versions — a chain of patches, one after another. That's not what's happening. Snapshots, Not Diffs Git's data model is built on snapshots . Every single commit captures the complete state of your project — every file, every folder, frozen in time. But if every commit stores everything, wouldn't that be enormous? No. Git hashes every piece of content. If two files are identical across commits, they produce the same hash — stored once, referenced everywhere. Snapshots are cheap because most files don't change. Three Objects, Connected by Hashes At its core, Git is a key-value store . You give it content, it hashes it, and stores the result as an object. There are exactly three types: Blob — raw file contents. No filename, no metadata. Just bytes and a hash. Tree — maps filenames

Continue reading on Dev.to

Opens in a new tab

Read Full Article
0 views

Related Articles