← Lessons/Branching & Merging

Branching & merging

A branch is a separate line of work. You make one to build a feature without touching the stable code on main; when it's ready, you merge it back. Creating a branch, committing on it and merging it back is the everyday workflow on every team: exactly what "knows Git" means.

This sandbox starts with an initialized repo and one commit already in place.

gitversion-controlbranching

Interview prep

Comfort with branch → commit → merge is the baseline expectation for collaborating on a team.

Why work on a branch instead of committing straight to main?

A branch isolates in-progress work so main stays stable and releasable. You can experiment, commit incrementally, and have the work reviewed (a pull request) before merging — and if it doesn't pan out, you just delete the branch. It also lets several people work in parallel without stepping on each other.