Git Architecture Fundamentals

Comments explain and debate Git's core model, including commits as immutable snapshots in a DAG rather than deltas, branches as pointers, and concepts like rebasing, reflog, and history immutability versus common misconceptions.

📉 Falling 0.5x DevOps & Infrastructure
2,941
Comments
19
Years Active
5
Top Authors
#9474
Topic ID

Activity Over Time

2008
6
2009
16
2010
56
2011
94
2012
79
2013
130
2014
101
2015
108
2016
148
2017
143
2018
150
2019
184
2020
240
2021
258
2022
293
2023
344
2024
305
2025
275
2026
11

Keywords

AFAIK e.g DAG stackoverflow.com JJ OS github.com VCS DDL SHA commits commit git branch branches mercurial rebase graph repo pointers

Sample Comments

aayjaychan • Oct 5, 2020 • View on HN

Git does hide the old commits as well. What git doesn't do is track which commits are replaced by which. So sharing mutable history and seeing how a commit evolved over time requires more heuristic than necessary.

schacon • Mar 18, 2010 • View on HN

The storage model does not - it is not file-delta based, like SVN and Mercurial. However, you as a developer can (and often do) think of the commits in terms of a changeset or "work introduced" - this is evident in tools that exist like 'rebase' which treats each commit in a branch as a patch and the collection of unique commits on that branch as a patch series and helps you transfer that series elsewhere. The 'cherry-pick' command is similar - it enforces your thinking of each commit as a cha

nerdponx • Oct 7, 2023 • View on HN

A Git repo is a DAG of commits, and each commit is a snapshot of your files, along with some metadata. Commits are immutable and point to their own parents. Branches and tags are pointers or labels on commits. Everything follows from that.

silon3 • Oct 3, 2013 • View on HN

Neither it is in git. See the discussions about how rebased commits are often preferred.

arxanas • Jan 9, 2023 • View on HN

It is not! See https://github.com/arxanas/git-branchless/wiki/Architecture#...

BerislavLopac • Mar 2, 2022 • View on HN

That's exactly what the actual git does too.

amelius • Jun 15, 2021 • View on HN

In case of git it is more like a blocktree, I suppose.

navaati • Feb 12, 2020 • View on HN

Completely agree.> Which in case of Git is that it's a DAGAnd one step beyond that, that it's a Merkel tree. It's key to understanding stuff like "if I change a commit, it changes all commit after that" or "if I move (cherry pick, rebase) this commit, I'm creating a new one, not really moving".

usr1106 • Aug 16, 2020 • View on HN

Branches are just pointers into a graph of commits. The graph cannot be mutated (it can be pruned by garbage collection but that does never happen related to an oh shit event, it takes weeks even in a heavily modified repo). The pointers can be modified to point anywhere else in the graph, which makes things look mutated without being mutated. Using reflog you can get your back to where your pointers pointed to at any earlier point of time.

torstenvl • Apr 30, 2024 • View on HN

Isn't that what a branch and a merge commit do?