1Branch equals your own copy. Main equals everyone's.
Nothing new happens technically in this session; sessions 04 and 05 already gave you everything needed. What changes is how to think about it. On this repository, a branch is not just a scratch space for a risky edit. It is a complete, private copy of the whole site, exactly as every other branch has been since session 04: same files, same pages, same CSS, isolated until you merge it. Main is the one branch connected to the pipeline from session 02, which means main is also the only branch anyone outside the people actively editing it will ever see rendered as the real, Entra-gated site.
That gives you, for free, the thing every engineering team pays good money to build: a safe copy to test changes in and a separate, protected copy that staff actually depend on.
2What a branch looks like before it reaches main
Cloudflare Pages, the service session 02 named as the thing that rebuilds this site, is commonly set up to build a preview of a branch or a pull request at its own separate, unlisted address, before that branch ever touches main. That preview is a real, working copy of the site built from your branch's files, reachable for review without affecting what staff see. Whether preview builds are turned on for this specific project is a Cloudflare Pages setting, not a git one, so check with whoever administers the Cloudflare project if you want to confirm it before relying on it.
Either way, the git side of this is unaffected: you branch, you commit, you push the branch, and whatever Cloudflare does with that branch, main is not touched until you merge.
3Why main is never the place to try something
Session 04 already made the technical case: a push to main is the one event that rebuilds the live site behind Entra. Here is the practical version. Trying a change directly on main means the very first time you see whether it actually works is also the first time every signed-in staff member sees it, or sees it broken. A branch removes that coincidence entirely. You can get something wrong, several times, entirely on your own branch, and nobody else ever has to know it happened.
4The flow in full
The sequence holds whether or not a preview build is configured. Without one, "review" simply means reading the diff and, if the practice folder is handy, trying the change there before merging. The discipline, not the tooling, is what keeps main safe.
5A short pre-merge checklist
Before running git merge or accepting a pull request into main on a site people are
actually using, four quick checks cover most real mistakes:
| Check | Command or action |
|---|---|
| What exactly is about to merge | git diff main...your-branch, reading every line before you trust it |
| Does the page load at all | Open the file, or the preview build, in a browser |
| Does dark mode still work | Click the theme toggle; this site supports both |
| Is anything unrelated included | git status before committing, the same habit from session 03's real example |
6Try it: see what's actually out there
Read-only, on the real HN - Training repository.
- Run
git branch -a. The-aflag lists remote branches too, not only the one you are on. See whether any branch other than main currently exists on this repository. - Run
git log main -3 --oneline. This is what a reviewer would read first: the most recent handful of commits already on main, for context before looking at anything new. - If you have access to the repository on github.com, open the Pull requests tab and note whether Cloudflare Pages has posted a preview link on any past one. That is the concrete answer to whether preview builds are active on this project.
7Check for understanding
-
Answer
The risk is specific to this project's pipeline: a push to main is what triggers Cloudflare Pages to rebuild the live site, which Entra then shows to every signed-in staff member. An untested change pushed straight there reaches that whole audience as soon as the build completes, which is exactly what a branch avoids.
-
Answer
Whether a branch gets its own preview build is configured on the Cloudflare Pages project, a setting independent of git. Git's job is the same either way: branch, commit, push. What Cloudflare does with that push is a separate layer, worth confirming with whoever administers the project.
-
Answer
git diff is read-only. Comparing main against your branch before merging shows exactly what is about to change, which is what lets you, or a reviewer on a pull request, decide whether it is actually ready rather than trusting it blind.
-
Answer
The one fixed point in the flow is the last step: production, the live Entra-gated site, only rebuilds once a merge actually lands on main. Everything before that, including whether a preview build exists, is about making the decision to merge a well-informed one; it does not change when production itself updates.
8Before session 07
- Note what you found when you ran
git branch -ain the lab. Session 07 asks who should be able to see those branches at all.
9Glossary
- Production
- The live, published version of the site, built from main and shown to staff behind Entra.
- Preview build
- A separate, working build of a branch or pull request at its own address, used to review a change before it reaches production.
- Pre-merge review
- Reading the diff, and ideally seeing the change run, before merging a branch into main.
10Sources
- Cloudflare, Preview deployments, Cloudflare Pages documentation.
- GitHub, GitHub flow, for the branch-review-merge-deploy sequence this session applies to this project.