Chapter 5
Branches: parallel versions of a project
Updated July 31, 2026
As long as work goes in a straight line, commits form a chain. Work rarely goes in a straight line. You are on day two of rewriting a section of the report, and it turns out the published version has the wrong date and it has to be fixed now. Branches exist for exactly this: to keep several versions of a project at once without worrying that one of them will ruin another.
A branch is a pointer, not a copy
The word "branch" is misleading. It sounds like git copies the whole folder somewhere. It copies nothing. A branch is a pointer to one commit, and it lives in a plain text file inside .git:
$ git branch feature-x # create a branch $ cat .git/refs/heads/feature-x f57048622b87f0c63f9aafa9efbbde29b3d75746 LockedThe rest of this chapter is part of a paid course
You are reading the open part. Buy the course to read the whole chapter.