Sitemap

🧭 The Complete Guide to GitHub Flow: A Practical Tutorial for Developers

3 min readJun 11, 2025

--

If you’re working with Git and GitHub, you’ve probably heard of GitHub Flow. It’s a simple yet powerful workflow that enables teams to collaborate efficiently and ship high-quality code continuously.

In this tutorial, we’ll walk through GitHub Flow step by step — with practical examples, commands, and best practices — so you can start using it effectively in your projects.

🧠 What is GitHub Flow?

GitHub Flow is a lightweight, branch-based workflow for continuous delivery. It’s especially great for teams that:

  • Work in small feature increments
  • Ship often
  • Want a clear and simple collaboration process

At a high level, GitHub Flow looks like this:

  1. Create a branch
  2. Make commits
  3. Open a pull request (PR)
  4. Review and discuss
  5. Merge the PR
  6. Deploy

🛠️ Prerequisites

Before diving in, make sure you have:

  • Git installed: git --version
  • A GitHub account
  • A repository to work on (either your own or a forked one)

1️⃣ Step 1: Create a Branch

Start with the main branch (or master, depending on your setup). Always pull the latest changes:

git checkout main
git pull origin main

Now, create a new branch for your feature or bugfix:

git checkout -b feature/user-profile

💡 Naming Tip: Use prefixes like feature/, bugfix/, or hotfix/ to keep branches organized.

2️⃣ Step 2: Make Commits

Edit your code, then add and commit your changes:

git add .
git commit -m "Add user profile page UI"

✅ Best Practice: Commit often with meaningful messages. Keep commits small and focused.

3️⃣ Step 3: Push and Open a Pull Request

Push your branch to GitHub:

git push origin feature/user-profile

Now go to your GitHub repo. GitHub will show a “Compare & pull request” button. Click it.

Get Yodgorbek Komilov’s stories in your inbox

Join Medium for free to get updates from this writer.

Fill out:

  • A clear title (e.g., “Add User Profile UI”)
  • A detailed description (what you did, why, screenshots, etc.)
  • Link to related issues, if any (e.g., Fixes #42)

4️⃣ Step 4: Review and Collaborate

Ask a teammate (or yourself, if solo) to review the PR.

During the review:

  • Use GitHub comments to ask questions or suggest changes
  • Push updates to the same branch; GitHub will automatically update the PR
  • Use Resolve conversation When feedback is addressed

🔄 If needed:

# Make changes
git add .
git commit -m "Address review feedback"
git push

5️⃣ Step 5: Merge the PR

Once the PR is approved and tests pass:

  • Click “Merge pull request”
  • Choose Squash & merge (recommended for a clean history)

Optionally, delete the branch after merging.

6️⃣ Step 6: Deploy (if applicable)

Many teams integrate GitHub Flow with CI/CD tools (like GitHub Actions, Jenkins, or CircleCI) to automatically deploy main to staging or production.

If you’re doing manual deploys, now is the time to:

git checkout main
git pull origin main
# trigger deployment script or CI

📦 Bonus Tips

✅ Keep main stable

Only merge main when your code is ready for production.

🧪 Write tests

Utilize tools such as JUnit, Espresso, or Mockito (for Android) in conjunction with CI runners to ensure quality.

🔄 Rebase for a clean history

git fetch origin
git rebase origin/main

📚 Example Scenario

Let’s say you’re fixing a login bug:

git checkout -b bugfix/login-error
# fix the bug
git add .
git commit -m "Fix crash on invalid login"
git push origin bugfix/login-error
# open PR, review, merge

Boom. Done. Clean, traceable, and collaborative.

🚀 Final Thoughts

GitHub Flow is one of the most intuitive and scalable workflows for software teams today. Whether you’re solo or part of a large team, using it consistently leads to:

  • Cleaner collaboration
  • Faster releases
  • Fewer bugs

If you’re not using GitHub Flow yet, now’s the perfect time to adopt it in your projects!

--

--