← Back to Git Course | Chapter 3: Branching | Lesson 9 of 9

GitHub Flow

What is GitHub Flow

GitHub Flow is a lightweight branching model built around a single long-lived main branch and short-lived feature branches -- unlike GitFlow's multiple permanent branches (develop, release, hotfix), GitHub Flow deliberately keeps only one permanent branch to minimize process overhead for teams that deploy continuously.

Example: What is GitHub Flow

bash
git checkout main
git checkout -b add-search

Branch From Main

Every piece of work -- a feature, a fix, an experiment -- gets its own descriptively-named branch cut directly from main, with no intermediate develop branch to merge through first.

Example: Branch From Main

bash
git checkout main
git checkout -b fix-header-bug

Open a Pull Request Early

GitHub Flow encourages opening a pull request as soon as a branch exists, even before the work is complete -- the PR becomes a running conversation thread for feedback, CI results, and progress visibility, not just a final review gate.

Example: Open a Pull Request Early

bash
git push -u origin fix-header-bug
# open a pull request immediately, even before work is complete

Merge and Deploy

Once a pull request is reviewed and its checks pass, it's merged directly into main -- and because main is meant to always be deployable in this model, that merge is typically followed immediately by an automatic or one-click deployment to production.

Example: Merge and Deploy

bash
git checkout main
git merge fix-header-bug
git push origin main

GitHub Flow vs GitFlow

GitHub Flow trades GitFlow's structured release/hotfix branches for simplicity: there's no separate develop branch to keep in sync, and no scheduled release branch -- every merge to main is a potential deploy, which suits teams practicing continuous delivery far better than GitFlow's more deliberate, versioned release cadence.

Example: GitHub Flow vs GitFlow

bash
git checkout -b feature-x main
# merges straight to main, no develop branch

Login to run this code

C/C++/Java/PHP execution requires a free account. Your code is saved — you'll land right back in the editor after logging in.