AI Hints
Home›Git & GitHub Tutorial›Team Workflows
Git & GitHub · Lesson 78 of 144

GitHub Flow

A simple team workflow.

⏱ 2 min read▶ Video at 1:24:46🎓 Free
Watch this lesson in the Git & GitHub courseWatch on YouTube ↗Full Git & GitHub course

When a whole team shares one repository, everyone needs to follow the same simple rules. The most popular set of rules is called GitHub flow. It has just one big idea. Main is always working, and every change goes through a branch and a pull request.

GitHub Flow
From the video: GitHub Flow
  • One shared repository
  • Everyone follows the same rules
  • Main always works

GitHub flow

Here are the steps. Update main, and create a branch with a clear name. Commit your work in small steps, and push the branch. Open a pull request, and ask for review. Fix anything reviewers ask for. Then merge, delete the branch, and start again from main.

  1. Branchfrom a fresh main
  2. Commit & pushsmall steps
  3. Pull requestask for review
  4. Mergethen delete the branch
GitHub flow
From the video: GitHub flow

A day in GitHub flow

Here's how a day starts. Switch to main, and pull, so we start from the latest version. Then create a branch named after the task. The rest is the add, commit and push you already know.

git
git switch main
Already on 'main'
Your branch is up to date with 'origin/main'.
git pull
Already up to date.
git switch -c fix-footer-color
Switched to a new branch 'fix-footer-color'

Summary

GitHub flow means main always works, and every change goes through a branch and a pull request. Next, how GitHub can enforce those rules.

Key takeaways
  • Main always works
  • Branch, PR, review, merge
  • Delete, and repeat
Next up: Protecting Main — rules GitHub enforces