🌿 Branching
Branches let you work on features, fixes, or experiments without affecting the main branch.
📋 List Branches
git branch
*marks the branch you’re currently on.- Add
-ato see remote branches too:
git branch -a
🌱 Create a New Branch
git checkout -b feature-name # Old way
git switch -c feature-name # Newer, simpler way
Tip: Start branch names with a short prefix, like feature/, bugfix/, or hotfix/.
🔄 Switch to an Existing Branch
git checkout branch-name # Old way
git switch branch-name # New way