Pull requests and code review

How a team gets your branch into main · 8 min

In one breath

A pull request (PR) is a GitHub feature, not a git command: "here's my branch, please review it and merge it into main". Teammates read the diff, comment, and approve. Automated checks (CI) build and test it, and then it's merged. Nobody pushes straight to main.

The workflow, start to finish

  1. git switch main → git pull: start from the latest.
  2. git switch -c fix/weapon-map-uproperty: your own branch.
  3. Work, add, commit, in small clear commits.
  4. git push -u origin fix/weapon-map-uproperty. -u remembers the link, so later it's just git push.
  5. Open the PR on GitHub (it offers a button after you push), or gh pr create from the terminal.
  6. Review: teammates comment on lines; you answer, push more commits to the same branch, and the PR updates itself.
  7. CI (automated build and tests) goes green.
  8. Approved → merge → delete the branch.

The name is confusing: you're asking them to pull your branch in. GitLab calls the same thing a merge request, which is clearer.

Three ways GitHub can merge it

ButtonResult on mainTeams pick it when
Create a merge commitAll your commits + a merge commitThey want the full history of how the work happened
Squash and mergeYour whole branch becomes one commitThey want one tidy commit per feature (very common)
Rebase and mergeYour commits replayed onto main, no merge commitThey want a straight-line history

It's a team setting. Just follow whatever the repo does.

Writing a PR people want to review

Reviewing someone else's

Interview tie-in

"How do you verify your work?" (your mock Q2) and "how do you take feedback?" both have a PR answer: "I review my own diff before asking anyone, keep PRs small enough to review properly, and treat review comments as free bug-finding." You already end each plugin Part with a whole-branch review and fix the findings in their own commits. That's the same habit.

Quiz yourself

Is a pull request a git feature?

No. It's a hosting-site feature (GitHub; GitLab calls it a merge request) built on top of branches.

List the steps from "start a fix" to "it's in main".

Pull main → new branch → commits → push the branch → open PR → review and fixes → CI passes → merge → delete branch.

Reviewer asks for a change. Do you open a new PR?

No. Commit to the same branch and push, and the PR updates automatically.

Squash and merge: what does main end up with?

One single commit containing the whole branch's changes.

Why keep PRs small?

Small diffs get careful reviews. Huge ones get skimmed and approved with bugs in them.

What does -u do in git push -u origin my-branch?

Sets the upstream link, so later plain git push / git pull on that branch know where to go.

What should a PR description include?

What changed, why, how it was tested, and screenshots or GIFs for anything visual.