<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/stop-memorizing-git-commands-learn-the-data-model-nawsqtjz9" -->

---
title: Stop Memorizing Git Commands. Learn The Data Model
description: Git's internal data model explained from first principles. Everything Git knows lives in the .git directory as a content-addressable object store with three...
canonical: https://daily.dev/posts/stop-memorizing-git-commands-learn-the-data-model-nawsqtjz9
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Stop Memorizing Git Commands. Learn The Data Model | daily.dev
og:description: Git's internal data model explained from first principles. Everything Git knows lives in the .git directory as a content-addressable object store with three...
og:url: https://daily.dev/posts/stop-memorizing-git-commands-learn-the-data-model-nawsqtjz9
og:image: https://api.daily.dev/og/posts/nawSQtjz9.png
og:image:alt: Stop Memorizing Git Commands. Learn The Data Model
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Stop Memorizing Git Commands. Learn The Data Model

**[YouTube](https://daily.dev/sources/youtube)** · 9 min read · 1 upvotes · 0 comments

## Summary

Git's internal data model explained from first principles. Everything Git knows lives in the .git directory as a content-addressable object store with three core object types: blobs (raw file contents), trees (directory mappings), and commits (snapshots with parent pointers). Branches are simply 41-byte text files holding a commit hash, and HEAD is a pointer to the current branch. The post walks through how git add, commit, reset, rebase, merge, and fast-forward merges all reduce to blob/tree/commit object creation and pointer manipulation. Git objects are immutable and append-only, so 'destructive' commands only move pointers — original commits remain accessible via reflog for 90 days.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.youtube.com/watch?v=Csd4lMKPC5g>

## Questions this post answers

### What are the three main object types in Git's data model?

Git uses three main object types: blobs, trees, and commits. A blob stores only the raw bytes of a file's content with no filename or metadata. A tree maps filenames to blob hashes (or nested tree hashes for subdirectories), representing a directory structure. A commit points to a root tree, a parent commit, author and timestamp info, and a message.

_Developers building a mental model of Git internals can find deeper breakdowns like this on daily.dev._

### Why does a fast-forward merge in Git not create a new commit object?

A fast-forward merge happens when the target branch has no new commits since the feature branch diverged, so there's a straight line between them. Git simply copies the commit hash from the feature branch's text file into the main branch's text file, sliding the pointer forward without creating any new object, since no divergent history needs reconciling.

_Anyone debugging merge behavior can revisit concepts like fast-forwards through daily.dev's developer content._

### Does git rebase move existing commits to new locations in the repository?

No, git rebase never moves existing commit objects because Git objects are immutable and append-only. Instead, Git reads the changes from the old commits and creates brand new commit objects with entirely new hashes, then points the branch at these new commits, leaving the original commits untouched in the objects directory.

_Developers untangling rebase confusion can dig into Git internals explanations curated on daily.dev._

## Similar posts on daily.dev

- [gitdatamodel Documentation](https://daily.dev/posts/gitdatamodel-documentation-yvvl6xej7) · Lobsters · 1 upvotes · 0 comments
- [On Git Refs](https://daily.dev/posts/on-git-refs-fwouzo4mh) · matklad · 1 upvotes · 0 comments
- [Understanding Git Without Memorizing Commands](https://daily.dev/posts/understanding-git-without-memorizing-commands-ws08nasbq) · Medium · 1 upvotes · 0 comments
- [A data model for Git \(and other docs updates\)](https://daily.dev/posts/a-data-model-for-git-and-other-docs-updates--boxensfwe) · Julia Evans · 3 upvotes · 0 comments

---

Tags: [#git](https://daily.dev/tags/git), [#version-control](https://daily.dev/tags/version-control), [#data-structures](https://daily.dev/tags/data-structures)

[View this post on daily.dev](https://daily.dev/posts/stop-memorizing-git-commands-learn-the-data-model-nawsqtjz9)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Stop Memorizing Git Commands. Learn The Data Model","url":"https://daily.dev/posts/stop-memorizing-git-commands-learn-the-data-model-nawsqtjz9","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/stop-memorizing-git-commands-learn-the-data-model-nawsqtjz9"},"datePublished":"2026-07-24T07:09:15.733Z","dateModified":"2026-09-14T06:14:29.699Z","description":"Git's internal data model explained from first principles. Everything Git knows lives in the .git directory as a content-addressable object store with three...","image":"https://i.ytimg.com/vi/Csd4lMKPC5g/sddefault.jpg","thumbnailUrl":"https://i.ytimg.com/vi/Csd4lMKPC5g/sddefault.jpg","isAccessibleForFree":true,"articleSection":"YouTube","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"YouTube","logo":"https://media.daily.dev/image/upload/s--W5zMumpP--/f_auto/v1725350181/logos/youtube","url":"https://daily.dev/sources/youtube"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/stop-memorizing-git-commands-learn-the-data-model-nawsqtjz9","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":1},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"git,version-control,data-structures","timeRequired":"PT9M","video":{"@type":"VideoObject","name":"Stop Memorizing Git Commands. Learn The Data Model","description":"Git's internal data model explained from first principles. Everything Git knows lives in the .git directory as a content-addressable object store with three...","thumbnailUrl":"https://i.ytimg.com/vi/Csd4lMKPC5g/sddefault.jpg","uploadDate":"2026-07-24T07:09:15.733Z","duration":"PT9M","url":"https://api.daily.dev/r/nawSQtjz9","embedUrl":"https://www.youtube.com/embed/Csd4lMKPC5g"}}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"YouTube","item":"https://daily.dev/sources/youtube"},{"@type":"ListItem","position":3,"name":"Stop Memorizing Git Commands. Learn The Data Model"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/stop-memorizing-git-commands-learn-the-data-model-nawsqtjz9#faq","mainEntity":[{"@type":"Question","name":"What are the three main object types in Git's data model?","acceptedAnswer":{"@type":"Answer","text":"Git uses three main object types: blobs, trees, and commits. A blob stores only the raw bytes of a file's content with no filename or metadata. A tree maps filenames to blob hashes (or nested tree hashes for subdirectories), representing a directory structure. A commit points to a root tree, a parent commit, author and timestamp info, and a message. Developers building a mental model of Git internals can find deeper breakdowns like this on daily.dev."}},{"@type":"Question","name":"Why does a fast-forward merge in Git not create a new commit object?","acceptedAnswer":{"@type":"Answer","text":"A fast-forward merge happens when the target branch has no new commits since the feature branch diverged, so there's a straight line between them. Git simply copies the commit hash from the feature branch's text file into the main branch's text file, sliding the pointer forward without creating any new object, since no divergent history needs reconciling. Anyone debugging merge behavior can revisit concepts like fast-forwards through daily.dev's developer content."}},{"@type":"Question","name":"Does git rebase move existing commits to new locations in the repository?","acceptedAnswer":{"@type":"Answer","text":"No, git rebase never moves existing commit objects because Git objects are immutable and append-only. Instead, Git reads the changes from the old commits and creates brand new commit objects with entirely new hashes, then points the branch at these new commits, leaving the original commits untouched in the objects directory. Developers untangling rebase confusion can dig into Git internals explanations curated on daily.dev."}}]}
```

