Branch

Version Controlbeginner

// Definition

An independent line of development in a Git repository — a movable pointer to a commit, letting you work on a feature or fix in isolation without touching the main line. Branches are cheap and disposable; the typical flow is branch off `main`, commit work, open a pull request, merge back.

// Why it matters

Branching is how QA work stays isolated and reviewable — test changes, fixtures, and CI tweaks live on a branch until they're proven, so a broken test never lands on main directly. Understanding branches is also prerequisite to reading PRs, resolving conflicts, and knowing which code a test run actually exercised.

// How to test

git branch feature/login-tests      # create
git switch feature/login-tests      # move onto it
# ...commit test work in isolation...
git switch main                     # main is untouched until you merge

// Common mistakes

  • Working directly on main so unreviewed changes ship straight to everyone
  • Long-lived branches that drift far from main (painful merges later)
  • Forgetting which branch you're on and committing to the wrong line

// Related terms