Areas we serve
Chapter 6

Branches, Pull Requests & Review

Keep main protected. The pull request is the handoff, not the chat.

Learning objectives

  • Keep agent work off main until a person reviews it
  • Open a pull request and read it as the real deliverable
  • Merge, request changes, or close without ever force-pushing

main is the shop floor

main is the branch you would deploy. Agents should not commit straight to it. A branch is another name pointing at a commit, so the agent can add snapshots without moving the shop floor. When the work is ready, a pull request on GitHub proposes: take the commits on this branch and add them to main.

git switch main
git pull
git switch -c waitlist
# agent edits only on this branch, then:
git push -u origin waitlist

On GitHub, open a pull request from waitlist into main. The page shows the same diff you read locally, plus a place for a human comment. That page is the agent’s handoff. The chat is not.

What review means when you are not a programmer

You are not expected to re-implement the waitlist. You are expected to answer questions the diff can support:

  • Does the description match the lines? If the title says “waitlist” and the diff changes payments, stop.
  • Are there secrets, .env files, or a database of real students?
  • Did a test or a manual booking still work on a copy, not on production?
  • Is the branch up to date with main, or is it about to overwrite someone else’s week?

GitHub can require a review before main moves. Turn that on for Workshop Co. even if the only reviewer is the owner. The setting is the policy. The agent’s confidence is not the policy.

DecisionWhenWhat happens to history
MergeThe diff is the thing you asked for, and it works on a copymain gains those commits. The branch can be deleted. The commits remain.
Request changesThe idea is right and the diff is wrongThe agent adds new commits on the same branch. Old review comments stay attached to the old lines.
CloseYou do not want the featuremain does not move. The branch history still exists if you need to look later.
Protect main

In the GitHub repository settings, require a pull request before merging to main, and turn off force pushes. An agent that “cleans history” with git push --force can erase the audit log for everyone. Ordinary pushes add commits. Force pushes rewrite them.

Deploy follows the merge

The host should build from origin/main, not from the agent’s laptop folder. A merge is the signal that this commit is allowed to become the live site. If the host pulls main on a timer, or you press deploy after the merge, the chain stays intact: prompt, branch, diff, review, merge, deploy. Skip a link and you are vibe coding directly on the customers.

Choose the action

The pull request diff matches the waitlist, tests pass on a staging copy, and .env is absent. A second file in the diff renames every CSS class in the admin page, which you did not ask for. Merge, request changes, or close?

Answer

Request changes. Ask the agent to drop the CSS rename and leave a commit that is only the waitlist. Closing throws away a good feature. Merging publishes an unrelated redesign you cannot explain to yourself next week.