The GitHub flow, drawn as one loop of six moves
By Christophe Paka · Facts checked on 30 October 2026
Alone, you added, committed and pushed every file straight to main. Then you joined a team. Now there are branches, pull requests, reviewers and a merge button, and nobody told you the order.
Guess the order and you open a second pull request for every comment, or push half a feature to the version everyone uses. The GitHub flow is one loop: branch, commit, pull request, comments, merge, delete the branch. The figure draws it across two lanes, your machine and github.com.

Use this diagram on your site
Free to share in your blog post, docs, course or slides, as long as the credit link stays. Paste the code below where the figure should go.
How to read this figure
Box 1: create a branch. Start from main, in the browser or with
git switch -c readme-edits. A branch is a named line of commits you can work on without touching the shared version. Give it a short name that says what you are doing.Box 2: make changes and commit. Commit on the branch, one complete change per commit. Both boxes in the top lane are git on your machine, so they need no network. See the four places a change lives for what each command moves.
Cross the line with git push. The arrow from box 2 down to box 3 is
git push. It sends your branch to github.com. Everything below the dashed line happens on GitHub.Box 3: create a pull request. Set base to main and compare to readme-edits. Read it as "merge compare into base". The pull request lets colleagues read your change and comment before anything joins main.
Box 4: address review, then loop. Your answers to comments are new commits on the same branch. They join the pull request by themselves. The dashed arrow sends you back to box 2, never to a second pull request.
Boxes 5 and 6: merge, delete, pull. Once approved, merge: your branch joins main. Then delete the branch; its commits stay on main. Last,
git pullbrings the updated main back to your machine, and the loop starts again.
Key takeaways
- Start every change on a fresh branch from main, with a name that says what it does.
- Answer review comments with new commits on the same branch, not with a new pull request.
- Delete the branch after the merge, then pull main before you start the next change.
Worked example: one README fix around the loop
You want to fix the README of pocket-ledger, the small expense tracker the book builds. Count the moves and note where each one runs.
- On your machine:
git switch -c readme-edits, edit the file, commit. Two moves, both offline. git push, then on GitHub open a pull request with base main and compare readme-edits. One move on GitHub.- A reviewer asks for a clearer sentence. You fix it, commit and push again. The same pull request now shows two commits. Back to box 2, not a new pull request.
- The reviewer approves. You merge, delete the branch, and run
git pullon main.
Result: Six moves, two on your machine and four on GitHub, plus one extra lap through box 2 for the review. main changed exactly once, at the merge, after someone read the change.
Questions readers ask
What is the GitHub flow?
It is the loop teams use to change the main version: create a branch, commit on it, open a pull request, answer comments with new commits, merge, and delete the branch. main changes only at the merge, after colleagues have read the change.
Should I open a new pull request to fix review comments?
No. Commit the fixes on the same branch and push. New commits join the open pull request by themselves, so the reviewer sees the whole conversation and every change in one place.
Is it safe to delete a branch after merging?
Yes. Deleting the branch removes the label, not the work: the commits stay on main after the merge. A branch is a movable bookmark, not a copy of your files, so a fresh one costs nothing next time.
Sources: GitHub flow (GitHub Docs); About pull requests (GitHub Docs).
This figure is from GitHub Made Crystal Clear, chapter 3.
The chapter builds the idea step by step, with recipes you can follow, a Try it to check yourself, and every source.
Get the book


