← Git & GitHub
// lesson 6 of 9
Branches
Try new ideas safely without breaking your main work.
// 1. read the lesson
A branch is a separate line of work. Your main branch holds the version that works. When you want to try something new, create a branch, experiment, and only bring it back when it is ready.
git switch -c add-dark-mode # ...make changes, add and commit... git switch main git merge add-dark-mode
git switch -c creates a new branch and moves you onto it. git merge brings the finished work back into main. Teams use one branch per feature or fix.
Written by the LEARN team.
Sign in to take the lesson test.
Your answers and code are checked and saved to your account.
Sign in