SyntaxStudy
Sign Up
Git Git Flow and GitHub Flow
Git Beginner 11 min read

Git Flow and GitHub Flow

Git Flow uses dedicated branches (main, develop, feature/*, release/*, hotfix/*) and suits projects with scheduled releases. GitHub Flow is simpler: one main branch, short-lived feature branches, and continuous deployment.

Example
# ---- GitHub Flow (simple, recommended for most teams) ----
# 1. main is always deployable.
# 2. Branch off main for every feature or fix.
# 3. Commit frequently and push to the same-name remote branch.
# 4. Open a Pull Request when ready for review.
# 5. Merge after review and passing CI.
# 6. Deploy immediately after merge.

git switch main && git pull
git switch -c feature/add-search
# ... work, commit, push ...
git push -u origin feature/add-search
# Open PR on GitHub → review → merge → deploy

# ---- Git Flow (structured, for scheduled releases) ----
# Main branches:
#   main    — production-ready code only
#   develop — integration branch for features

# Supporting branches:
#   feature/*  — branched from develop, merged back to develop
#   release/*  — branched from develop when code is release-ready
#   hotfix/*   — branched from main to fix production bugs

# Feature:
git switch -c feature/payment develop
# ... develop the feature ...
git switch develop && git merge --no-ff feature/payment

# Release:
git switch -c release/1.2.0 develop
# ... final testing, version bump ...
git switch main    && git merge --no-ff release/1.2.0 && git tag v1.2.0
git switch develop && git merge --no-ff release/1.2.0

# Hotfix:
git switch -c hotfix/1.1.1 main
# ... fix critical bug ...
git switch main    && git merge --no-ff hotfix/1.1.1 && git tag v1.1.1
git switch develop && git merge --no-ff hotfix/1.1.1