> Git has an elegant and powerful underlying model based on a few simple concepts:
Commits are immutable snapshots of the repository
Branches are named sequences of commits
Every object has a unique ID, derived from its content
I would list them as:
Every object has a unique ID, derived from its content
- and every commit id depends on its ancestors' commit ids
Each commit has an associated snapshot (file tree) of the repository
A branch is a named reference to a commit
- the referenced commit changes with addition/rebase/amend of commit(s)
Not quite as compact or elemental but a usably granular mental model.
If you want to learn how git works you can read about it, or merely look at the small text files inside a .git directory.
You can get by quite well w/o really understanding objects, just commits. So I like to start teaching Git concepts by looking at commits and refs first, then add color with objects.
If you want to learn how git works you can read about it, or merely look at the small text files inside a .git directory.