Git Branches: Intuition and Reality
Git’s branching model often clashes with developers’ intuitions, since what many imagine as tree-like “lines of history” are in reality just movable pointers to commits in a DAG of snapshots. Commenters debate whether Git’s power and internal consistency justify its notoriously baroque interface, arguing over how much blame lies with poor mental models, bad tutorials, or Git’s design itself. Many advocate learning Git “from the bottom up” (commits, refs, snapshots) and using tools like reflog, rebase, and visual UIs, while others wish for higher‑level workflows or alternative VCSs that better match how people naturally think about version control.
Branch semantics and mental models
- Strong emphasis that in Git a branch is just a movable pointer (a “label” or “wandering tag”) to a single commit, not a container of commits or a literal tree-branch structure.
- HEAD is another pointer to “where you are now”; it can point to any commit, not necessarily a branch tip, which makes “detached HEAD” confusingly named.
- Several commenters note the everyday “tree” metaphor (trunk/branch) misleads people into wrong expectations about where branches “start” and how merging should behave.
- Others stress that every branch’s history goes back to the repository root; “main” is only special by convention, not by Git’s model.
Usability, intuition, and design
- Disagreement over whether Git is intuitive: some say it “just makes sense” once you see branches as pointers; others say the prevalence of bad blog posts and confusion proves the model and UI are non-intuitive.
- Debate on whether tools should match naive intuition vs. teaching users more powerful but less obvious models.
- Criticism that Git’s UI is baroque, overloaded (
checkoutespecially), and that Git solves problems many users don’t have, raising cognitive load. - Counterpoint: Git’s power and consistency justify complexity; simpler UIs or centralized VCSs trade away flexibility and workflows.
Workflows and command usage
- Many people report surviving with a tiny subset of commands (
pull,checkout/switch,merge,commit,push,add,status). - Others argue professionals must know more:
rebase(often interactive),reset,stash,reflog,log,diff,blame,cherry-pick,tag. - Strong support for rebasing and squashing to keep a linear, readable main history; others warn about history rewriting and prefer merge commits.
reset --hardand stash are used aggressively by some, praised as powerful but acknowledged as dangerous when uncommitted changes exist.
History, renames, and internals
- Several explanations that Git stores immutable snapshot commits in a DAG/Merkle tree; diffs and renames are computed later.
- Moving/renaming files is not first-class history; it’s inferred heuristically from content similarity, which some consider elegant and others see as a practical weakness vs VCSs that record renames explicitly.
- Discussion of merge commits having multiple parents, fast-forward merges, disconnected commit graphs, and the lack of a stored “parent branch” or branch lineage.
Teaching and learning Git
- Multiple recommendations to learn Git “from the bottom up” (objects, refs, DAG) before memorizing porcelain commands.
- Links and references (interactive branching visualizers, “commits are snapshots” explanations, Git book/user manual) are cited as especially helpful.
- Ongoing tension: many feel repeated “RTFM” advice misses that even smart users struggle, suggesting a real UX/design problem rather than just a documentation gap.