What you will learn
- Create and switch branches
- Merge cleanly
- Resolve conflicts
New to this? Start here
The basics, in plain English
A branch lets you work on a new feature on a separate copy of the code, without touching the main version. When the feature is ready, you merge it back in. This is how teams build many things at once safely.
- Branch
- A separate line of work, like a parallel copy of the code you can change freely.
- main
- The primary branch that holds the official, working version of the code.
- Merge
- Combining the changes from one branch back into another.
- Conflict
- When two branches changed the same line, and Git asks you to choose which wins.
- Why branch
- So unfinished work stays isolated and never breaks the main version everyone uses.
01
Branches are cheap
A branch is just a movable pointer to a commit. Merge brings histories together; conflicts happen when the same lines diverge.
Try it yourself
bash
$git switch -c feature/login↳Create a new branch and switch to it in one step.$git merge main↳Pull the latest main into your branch.$git branch -d feature/login↳Delete the branch once it has been merged.↳ lines explain what each command does — only the commands get copied
Finished this topic?
Mark it done to earn 100 XP and keep your streak alive.