← Git

Workflows & Best Practices

What is a branching workflow, and how do Git Flow and GitHub Flow differ?

Show answer — try answering out loud first

A branching workflow is a set of rules about how the team uses branches. Git Flow is more elaborate: long-lived branches (main, develop) plus feature, release, and hotfix branches. GitHub Flow is simple: a single main branch (main) and short-lived feature branches that are integrated via PR and deployed often.

Knowing how to use branches is not enough: the team needs to agree on how to use them. The two best-known models:

  • Git Flow (more formal):

    • main: production code.
    • develop: integration of work in progress.
    • feature/*: each new feature, branches off develop.
    • release/*: prepare a version.
    • hotfix/*: urgent fixes from main.
    • Good for projects with planned versions and releases.
  • GitHub Flow (more agile):

    • Only main (always deployable).
    • Short-lived feature branches that branch off main.
    • They are integrated via Pull Request and deployed continuously.
    • Good for continuous deployment and modern web teams.

Today, with CI/CD, the trend is toward simple workflows like GitHub Flow.

# --- GitHub Flow: simple, one main branch ---
git switch main
git switch -c feature/login   # short-lived feature branch
# ...commits...
git push -u origin feature/login
# A PR is opened against main, reviewed, merged, and deployed

# --- Git Flow: long-lived branches ---
git switch develop
git switch -c feature/carrito   # feature branches off develop
# ...commits...
git switch develop
git merge feature/carrito       # integrated into develop
# When preparing a version: release/1.0 is created from develop
# An urgent bug in production: hotfix/1.0.1 branches off main

Believing that "there is only one correct workflow." It depends on the project: Git Flow can be too heavy for a small team with continuous deployment, and GitHub Flow can fall short for software with formal versions. Another mistake is not agreeing on the workflow as a team and letting everyone use branches their own way.

"A branching workflow is how the team agrees to use branches. Git Flow is more formal: long-lived branches like main and develop, plus feature, release, and hotfix branches; it fits well with planned versions. GitHub Flow is simpler: only main, short-lived feature branches that are integrated via PR and deployed often; it fits continuous deployment. There is no single correct one: it depends on the project, although with CI/CD the trend is toward simple workflows like GitHub Flow."

Quick challenge

A small team deploys its web app several times a day with CI/CD. Which workflow fits better, Git Flow or GitHub Flow?

See answer

GitHub Flow. With continuous deployment and a web app that ships several times a day, a simple workflow is best: a single main branch that is always deployable and short-lived feature branches that are integrated via PR and deployed right away. Git Flow, with its develop, release, and hotfix branches, adds ceremony that makes more sense when you manage formal versions and planned releases.