Getting Started with Git — Chapter 3 / 4
Branches
Branches let you work on different things at the same time. They are the most powerful feature of Git. And they are simpler than you think.
A branch = a pointer
Key term: branch
A branch is not a copy of the code. It is just a small label that points to a commit. It's like a sticky note on a page of a book. The sticky note says "I am here". Moving the sticky note is instant. The book does not change.
Full guide on git branch →When you create a branch, Git creates a tiny file. This file contains the hash of the commit you are on. That's it. Nothing is copied.
Creating a branch is instant. It takes almost no disk space.
# main and feature point to commits
main → a1b2c3d
feature → e4f5g6h
HEAD → main (you are on main)
Continue on the app
This chapter is available on the GitQuest mobile app. Download it free to continue your Git learning journey.