beginnerBranches & HEAD
Branch
The Definition
A branch is a movable pointer to a commit that represents an independent line of development.
Mental Model
"Think of a branch as a pointer that moves as you make commits. Branches are cheap in Git - they're just 41-byte files pointing to commits."
Visual Simulation
Live Engine
Watch Out (Common Pitfalls)
!
Thinking branches are copies of the entire repository
!
Not creating branches for new features or bug fixes
!
Letting branches diverge for too long without merging
Hands-on Command
shell
~ $
git branch feature-login
git checkout -b feature-login (create and switch)