AtomLearnAtomLearn
DashboardGoalsPathAchievementsReviewSign In
DashboardGit & Version ControlBranches & Switching
Git & Version ControlNot Started

Branches & Switching

Create, switch, and delete branches to work on features in isolation

0%
Knowledge0%
Learn & Drill
Fluency0%
Drill & Speed
Retention0%
Mastery & Review
Confidence0%
All modes
Practice
Knowledge
Fluency
Retention

Knowledge Debt detected

You can study this freely — but your score may plateau if these foundations have gaps. The Mastery badge requires them to be solid.

Explanation

A is how Git lets multiple people (or ideas) develop in parallel without stepping on each other.

Create a branch

bash
git branch feature-login     # creates the branch
git switch feature-login     # moves you onto it
# shortcut:
git switch -c feature-login  # create + switch in one command

List branches

bash
git branch          # local branches (* marks current)
git branch -a       # local + remote branches

Delete a branch

bash
git branch -d feature-login   # safe delete (only if merged)
git branch -D feature-login   # force delete (even if unmerged)

The main branch is usually called main (modern) or master (legacy). Never commit experimental work directly to main.

Examples

Start a feature branch

Creating a branch before starting any work is the standard team workflow — it keeps main clean and your work reviewable.

# You are on main
git switch -c add-search-bar   # create + switch
# ... make changes ...
git add .
git commit -m "feat: add search bar to header"
git switch main                # go back when done

List and clean up branches

Deleting merged branches keeps the repo tidy. Use -D only when you are sure you no longer need the work.

git branch
# * main
#   add-search-bar
#   fix-login-bug

git branch -d fix-login-bug   # delete after merging
git branch -a                 # see remote branches too

How well did you understand this?

Next in Git & Version Control

Merging & Conflict Resolution

Continue