
Module 8 Lesson 4: GitHub Flow
Simple, fast, and agile. Learn GitHub Flow—the preferred workflow for modern web applications and teams that practice continuous delivery.
Module 8 Lesson 4: GitHub Flow
Git Flow (from the previous lesson) is powerful, but many modern web teams found it too complicated. They didn't want a develop branch and a main branch. They wanted something faster.
GitHub Flow is a lightweight, branch-based workflow that is designed for teams that deploy to production frequently (often multiple times per day).
1. The Six Simple Rules
GitHub Flow consists of just six steps:
- Anything in the
mainbranch is deployable. (It must always pass all tests). - To work on something new, create a descriptively named branch off of
main(e.g.,feature/new-login). - Commit to that branch locally and regularly push your work to the same named branch on the server.
- When you need feedback or help, or you think the branch is ready for merging, open a Pull Request.
- After someone else has reviewed and signed off on the feature, you can merge it into
main. - Once it is merged and pushed to
main, it is immediately deployed to production.
2. GitHub Flow vs. Git Flow
| Feature | Git Flow | GitHub Flow |
|---|---|---|
| Main Branch | Only contains releases | Contains latest "Live" code |
| Dev Branch | Yes (develop) | No |
| Complexity | High (5+ branch types) | Low (Only 2 branch types) |
| Speed | Slower (Release cycles) | Fast (Continuous Delivery) |
graph TD
Main["main (Always Live)"] -- "Branch" --> Feature["feature/X"]
Feature -- "Commit" --> Feature
Feature -- "Review / PR" --> Merge["Merge to main"]
Merge --> Deploy["Auto-Deploy to Server"]
Deploy --> Main
3. Why it works for the Web
In web development, you don't usually need to support multiple versions (like a mobile app or a desktop OS). There is only one "Version"—the one currently running on the server. GitHub Flow is perfectly optimized for this "Single Version" reality.
Lesson Exercise
Goal: Compare the Complexity.
- Imagine you are a solo developer building a blog.
- You need to change the font size of the titles.
- Write down the branches you would need to create in Git Flow. (
develop, thenfeature/font, then maybe arelease/font?). - Now, write down the branches you would need in GitHub Flow. (Just
feature/font). - Which one feels more natural for a quick change?
Observation: You'll see that GitHub Flow removes the "Bureaucracy" of Git. It trusts your automated tests and your peer reviews to keep main stable.
Summary
In this lesson, we established:
- GitHub Flow is the standard for Continuous Delivery.
- It replaces the
developbranch with a "Deployablemain" rule. - It is significantly faster and easier to manage than Git Flow.
- It relies heavily on Pull Requests and Automated Testing (CI).
Next Lesson: Some teams think even branches are too slow. Welcome to the "Final Level" of Git strategies: Lesson 5: Trunk-Based Development.