# GitHub flow for beginners

> Branch, commit, open a pull request, address review, merge, then delete the branch.

Source: https://fullbytedeveloper.com/blog/github-flow-for-beginners
Published here: 2026-12-03, updated 2026-12-03

GitHub flow is a short loop: branch off the default branch, change code there, ask for review with a pull request, merge when ready, delete the branch [1]. It is the same idea whether you ship site policy or app code [1]. Pair later with [GitHub branch protection settings](/blog/github-branch-protection-settings) and [make a private repo public checklist](/blog/make-private-repo-public-checklist).

## Quick start (under a minute)

In a repo you control, create a branch, make one commit, and push it. You do not need to open the pull request yet to prove the git side works:

```bash
git switch -c docs/fix-typo
git commit --allow-empty -m "Document GitHub flow quick start"
git push -u origin docs/fix-typo
```

You should see `new branch` (or `branch set up to track`) from `git push` and a compare URL in the terminal on modern git [1]. Open that URL or use GitHub's "Compare and pull request" banner on the repository page [3].

## The six steps GitHub documents

GitHub's official flow compresses collaboration into six repeatable steps [1]:

1. **Create a branch** with a short name (`fix-login-typo`). Work stays off the default branch so others can review [1].
2. **Make changes** on that branch: edit, commit, and push so the remote holds a backup and teammates can see progress [1].
3. **Create a pull request** with a summary of the problem and the fix; mark draft for early advice [1] [2].
4. **Address review comments** by pushing more commits; the pull request updates automatically [1].
5. **Merge your pull request** when ready [1].
6. **Delete your branch** after the merge [1].

A pull request is where GitHub hosts that conversation. It is not a second copy of the repository; it is a proposed merge between two branches with metadata and checks attached [2].

## Walk the loop on your machine (teaching picture)

<figure aria-label="GitHub flow from default branch through feature branch pull request review merge and branch delete">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 360 200" role="img" aria-hidden="true">
  <defs>
    <marker id="githubflowforbeginners-gh-arr" markerWidth="8" markerHeight="8" refX="7" refY="4" orient="auto">
      <path d="M0,0 L8,4 L0,8 Z" fill="#14b8a6"/>
    </marker>
  </defs>
  <rect x="0" y="0" width="360" height="200" rx="12" fill="#0b1f3a"/>
  <rect x="16" y="65" width="66.6667" height="70" rx="6" fill="#123052" stroke="#14b8a6" stroke-width="1.33333"/>
  <text x="49.3333" y="98" text-anchor="middle" font-size="12" font-weight="600" fill="#e6edf7" font-family="system-ui,sans-serif">default</text>
  <text x="49.3333" y="114" text-anchor="middle" font-size="12" fill="#e6edf7" font-family="system-ui,sans-serif">branch [1]</text>
  <rect x="133.333" y="45" width="80" height="110" rx="6" fill="#123052" stroke="#14b8a6" stroke-width="1.33333"/>
  <text x="173.333" y="84" text-anchor="middle" font-size="12" font-weight="600" fill="#e6edf7" font-family="system-ui,sans-serif">feature branch</text>
  <text x="173.333" y="102" text-anchor="middle" font-size="12" fill="#e6edf7" font-family="system-ui,sans-serif">commit + push [1]</text>
  <text x="173.333" y="118" text-anchor="middle" font-size="12" fill="#e6edf7" font-family="system-ui,sans-serif">review pushes [1]</text>
  <rect x="264" y="65" width="80" height="70" rx="6" fill="#123052" stroke="#14b8a6" stroke-width="1.33333"/>
  <text x="304" y="96" text-anchor="middle" font-size="12" font-weight="600" fill="#e6edf7" font-family="system-ui,sans-serif">pull request</text>
  <text x="304" y="112" text-anchor="middle" font-size="12" fill="#e6edf7" font-family="system-ui,sans-serif">review [2]</text>
  <line x1="82.6667" y1="100" x2="130.667" y2="100" stroke="#14b8a6" stroke-width="1" marker-end="url(#githubflowforbeginners-gh-arr)"/>
  <text x="106.667" y="92" text-anchor="middle" font-size="12" fill="#e6edf7" font-family="system-ui,sans-serif">branch</text>
  <line x1="213.333" y1="88" x2="261.333" y2="88" stroke="#14b8a6" stroke-width="1" marker-end="url(#githubflowforbeginners-gh-arr)"/>
  <text x="237.333" y="80" text-anchor="middle" font-size="12" fill="#e6edf7" font-family="system-ui,sans-serif">open PR</text>
  <path d="M456 128 L456 156 L74 156 L74 128" fill="none" stroke="#14b8a6" stroke-width="1" marker-end="url(#githubflowforbeginners-gh-arr)"/>
  <text x="180" y="172" text-anchor="middle" font-size="12" fill="#e6edf7" font-family="system-ui,sans-serif">merge then delete feature branch [1]</text>
</svg>
</figure>

The diagram is git plus GitHub product features. Local git never "opens" a pull request by itself; you create it on GitHub (web, `gh pr create`, or API) once the remote branch exists [2] [3]. Step six, delete the branch, is the habit most beginners skip; the merge is not the finish line.

## Worked example: branch, commit, and observed git output

This sequence was run in a fresh test repository (git 2.43, 2026-12-03):

```bash
git init -q demo && cd demo
git switch -c fix-demo
git commit --allow-empty -m "Empty commit for flow demo"
git branch -vv
```

Observed:

```text
* fix-demo 382ca6d Empty commit for flow demo
```

After `git push -u origin fix-demo` against a GitHub remote, typical client output includes:

```text
remote: Create a pull request for 'fix-demo' on GitHub by visiting:
remote:      https://github.com/OWNER/REPO/compare/main...fix-demo
To github.com:OWNER/REPO.git
 * [new branch]      fix-demo -> fix-demo
branch 'fix-demo' set up to track 'origin/fix-demo'.
```

That compare link is the front door to step four in the flow [3]. Replace `OWNER`, `REPO`, and the default branch name with your repository facts.

## Treat the pull request as the conversation

GitHub describes a pull request as the place to propose changes and let collaborators review before merge [2]. Status checks (CI jobs) attach to the commit at the tip of the branch; each new push re-runs configured workflows [1]. Branch protection can require green checks and human approval before the merge button becomes available. That policy sits on top of the flow, not inside git itself ([branch protection settings](/blog/github-branch-protection-settings)).

Draft pull requests exist so you can signal work in progress [3]. Open early when you want architecture feedback; keep the title honest if tests are red. Reviewers filter noise better when the description states intent, risk, and how to test.

Use one branch per unrelated change set [1]. Mixing a typo fix and a schema migration in one pull request forces an all-or-nothing review and blocks the typo if the migration stalls.

Pull request templates in `.github/pull_request_template.md` repeat team questions (risk, test plan, screenshots). They are not part of GitHub flow itself [1], but they reduce review ping-pong. Fill them honestly; empty templates teach reviewers to ignore the box.

## Merge styles (what happens to history)

GitHub offers merge commit, squash merge, and rebase merge on many repositories [2]. Teams pick based on how they want `main` to read:

| Style | What lands on default branch |
|---|---|
| Merge commit | A merge commit joins the branch history |
| Squash merge | One commit with the pull request title message |
| Rebase merge | Linear replay of branch commits |

The flow does not mandate one style [1]. Argue about squash versus rebase in team docs, not in this beginner loop. Deeper git history choices live in Git rebase vs merge.

## More reader questions

**Should every commit touch one file?** No. GitHub flow cares that each commit on the branch makes sense as a step toward the pull request goal [1]. One file per commit is a style some teams like; it is not required.

**What if CI fails on the pull request?** Push another commit on the same branch. The pull request head moves forward and checks re-run [1]. Merge when required checks pass under your branch protection rules.

## Traps I still see

Committing straight to `main` on a shared repo. GitHub flow exists because simultaneous direct commits collide and skip review [1]. Personal forks and solo repos are exceptions until you invite collaborators.

Opening a pull request from an unpushed branch. The remote must have your commits so CI and reviewers fetch them [3]. Push first, then open.

Leaving dead branches forever. Step six is delete the branch [1]. Restorable history lives in the merged pull request and default branch commits.

Confusing "close pull request" with "merge." Close abandons the proposal without landing code [2]. Merge applies it. Use close when you decided not to ship.

Green CI means correct product behavior. Checks only cover what you wired. Human review still catches wrong requirements.

GitHub flow replaces release management. It is a collaboration loop on one repository [1]. Release trains, environments, and tagging are separate practices often paired with [what is CI/CD](/blog/what-is-ci-cd).

Labels and assignees on a pull request are optional metadata [2]. They do not change git history. They help triage when twenty branches are open. Linking `Fixes #123` in the description can close an issue on merge when the repository enables that behavior; check your org settings before you rely on it in release notes. When automated builds gate merge, read [what is CI/CD](/blog/what-is-ci-cd) alongside [GitHub branch protection settings](/blog/github-branch-protection-settings). For the editor and agent setup that keeps that loop honest on a serious repo, see [Cursor setup for a serious repo](/blog/cursor-setup-for-serious-repo). Your next experiment: open a draft pull request before the code is pretty, ask one reviewer question in the description, and see whether feedback arrives earlier than your usual last-day rush.

Send this to the teammate still pushing straight to main on a shared repo.

Image: Thick teal arrow passing through a copper ring then shattering into fragments, with a branch arch overhead and a small return arrow below, no people.
https://fullbytedeveloper.com/media/github-flow-for-beginners/github-flow-for-beginners-venice.webp
GitHub flow loops branch, review, merge, and delete.

## Sources

1. [GitHub Docs: GitHub flow, accessed 2026-12-03](https://docs.github.com/en/get-started/using-github/github-flow)
2. [GitHub Docs: About pull requests, accessed 2026-12-03](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests)
3. [GitHub Docs: Creating a pull request, accessed 2026-12-03](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request)
4. [Full Byte Developer: GitHub branch protection settings](https://fullbytedeveloper.com/blog/github-branch-protection-settings)
5. [Full Byte Developer: Make a private repo public checklist](https://fullbytedeveloper.com/blog/make-private-repo-public-checklist)
