Branches and pull requests

Beginner 10 min read

Work on a change in its own branch and get it reviewed before it joins the main line.

Why it matters

Branches let several people change the same project without stepping on each other. A pull request is where the change is reviewed and checked by CI before it is merged.

Where it fits

  1. Plan & Design
  2. Develop
  3. ● Version control
  4. Verify
  5. Build & Package
  6. CI/CD
  7. Deploy
  8. Operate

What you will learn

  • Create a branch, commit to it and open a pull request.
  • Resolve a simple merge conflict.
  • Review a change usefully.

Before you start

A branch per change

Example
git switch -c fix/login-redirect   # new branch from where you are
# ... edit, add, commit ...
git push -u origin fix/login-redirect
# then open a pull request on your Git host

git switch main
git pull                           # get what others merged

Reviewing

  • The change does what the description says, and nothing unrelated.
  • It has tests, and CI passed.
  • Names and structure are clear to someone new.
  • No secrets, debugging leftovers or commented-out code.

Tip: Small pull requests are reviewed faster and better. Split a large change into steps that each make sense alone.

A merge conflict means two branches changed the same lines. Git marks both versions in the file; you keep the right result, remove the markers, then git add and commit.

Official documentation and references

Documentation

Reference

Learn next

Done with this topic?

Reviewed 2026-10-23. Links go to the official documentation unless marked otherwise.