Skip to main content
Module 3 · Lesson 1 of 410/34 in the course~15 min
Module lessons (1/4)

Branches as mutable pointers to commits

Lesson preview5 hands-on exercises readyGit & Modern Collaboration · Module 3 — Branches as Lightweight Pointers

See how HEAD, branch refs and commits relate inside the object database without copying directories.

What you'll learn in this lesson

  • Understand Git branches not as copied directories, but as lightweight 41-byte mutable pointers to commit SHAs.
  • Separate HEAD (what you have currently checked out) from branch refs (refs/heads/*).
  • Create pointers (git branch <name>) without switching away from your active branch.

Overview

Other version control systems copy entire directory trees into separate folders (/branches/feature-x) every time you start a task.

Git represents every branch as a single tiny 41-byte file inside .git/refs/heads/ storing one commit SHA. Creating a branch allocates zero new file blobs and zero new commits — it merely drops a sticky note onto a commit node!

Sections covered in this lesson

  1. 1Why Git Branching Takes Milliseconds
  2. 2Compare Divergence Topologies Live
Pro Lesson · Module 3 — Branches as Lightweight Pointers

Unlock "Branches as mutable pointers to commits" and the full Git & Modern Collaboration curriculum

See how HEAD, branch refs and commits relate inside the object database without copying directories.

Unlock all 5 hands-on exercises in this lesson plus every advanced WebAssembly module with automated checks.

  • Instant access to all advanced modules in Git & Modern Collaboration plus 17 more courses
  • Hands-on browser exercises with automated test suites and solutions
  • 14-day money-back guarantee processed via Paddle.com

14-day guarantee · Cancel anytimeModule 1, all 18 interactive games, and cheatsheets are always free.