What is a Branch?
A lightweight, movable pointer to a specific commit, allowing parallel development.
A Branch is Just a Pointer
A branch in Git is simply a lightweight, movable pointer to one of your commits. Unlike older version control systems, a branch is not a physical copy of your files.
It's just a small file containing the 40-character checksum of the commit it points to.
Why it matters
Branches provide a safe, isolated sandbox. You can work on a new feature, fix a bug, or experiment with code without any risk of breaking the main production codebase.
Because they are just pointers, branching and switching branches in Git is nearly instantaneous.
How it works
Git maintains a special pointer called HEAD that determines which branch is currently active.
When you make a new commit, Git automatically moves the active branch pointer forward to point to your new commit.
Check yourself
Pick an answer to lock it in, then read why. Getting one wrong is part of how it sticks.
Remember this
- A branch is just a lightweight pointer to a commit.
- HEAD points to your current active branch.
- Making a commit automatically moves the active branch pointer forward.
Done with this concept?
Mark it complete to track your progress. No login needed.