DEV Community

Cover image for Git Workflows Overview
davinceleecode
davinceleecode Subscriber

Posted on

Git Workflows Overview

This document outlines common Git workflows used in software development teams. Choose the one that best fits your project's size, complexity, and collaboration needs.


1️⃣Centralized Workflow

A simple workflow where all developers push and pull from a single central branch, usually main.

Best for:

  • Small teams or solo projects
  • Simple projects without parallel features

Branch Structure

Repo
└── main
     └── [all commits here]
Enter fullscreen mode Exit fullscreen mode

Example

# Start working from the main branch
git checkout main
git pull origin main

# Make changes
git add .
git commit -m "feat: update homepage layout"

# Push directly to main
git push origin main

Enter fullscreen mode Exit fullscreen mode

2️⃣ Feature Branch Workflow

Each new feature or bug fix is developed in its own branch, then merged into main or develop via a pull request.

Best for:

Teams with code review practices

Projects using CI/CD pipelines

Branch Structure

main
├── feature/login-page
├── bugfix/fix-footer
Enter fullscreen mode Exit fullscreen mode

Example

git checkout -b feature/user-login
# work on feature
git commit -m "feat: add login form"
git push origin feature/user-login
# create PR to main
Enter fullscreen mode Exit fullscreen mode

3️⃣ Git Flow Workflow

A more structured workflow with separate branches for development, releases, hotfixes, and features.

Best for:

  • Large teams
  • Projects with scheduled releases

Branch Structure

main
develop
├── feature/*
├── release/*
└── hotfix/*
Enter fullscreen mode Exit fullscreen mode

Example

git checkout -b feature/user-profile develop
# complete feature, merge into develop
# prepare release: git checkout -b release/1.0.0 develop
Enter fullscreen mode Exit fullscreen mode

4️⃣ GitHub Flow

A lightweight workflow where everything happens on feature branches and is merged into main via PRs.

Best for:

  • Web applications with continuous deployment
  • Teams using GitHub Actions or CI tools

Branch Structure

main
├── feature/*
Enter fullscreen mode Exit fullscreen mode

Example

git checkout -b feature/payment-integration
# work and commit
git push origin feature/payment-integration
# create PR into main
Enter fullscreen mode Exit fullscreen mode

5️⃣ Trunk-Based Development

Developers work directly in the main (or trunk) branch, sometimes using short-lived branches that are merged multiple times a day.

Best for:

  • High-speed deployments
  • Advanced CI/CD setups

Branch Structure

main
Enter fullscreen mode Exit fullscreen mode

Example

git checkout -b quick-fix
# fix and push fast
git merge --squash quick-fix into main
Enter fullscreen mode Exit fullscreen mode

Choosing the Right Workflow

Workflow Best For Complexity
Centralized Solo/small projects
Feature Branch Mid-size teams ⭐⭐
Git Flow Enterprise & staged releases ⭐⭐⭐
GitHub Flow Fast-moving, modern teams ⭐⭐
Trunk-Based CI/CD-first environments ⭐⭐

Bonus

  • Use Pull Requests to ensure code review and CI checks
  • Keep feature branches short-lived
  • Delete merged branches to keep repo clean
  • Always pull before starting new work

Top comments (2)

Collapse
 
davinceleecode profile image
davinceleecode

Most of the time, what Git workflow are you working on? Please comment down 👇

  • 🧵 Centralized – one main branch for all
  • 🌿 Feature Branch – create a branch for each new task
  • 🚢 Git Flow – structured release model with develop/main
  • ⚡ GitHub Flow – fast-moving PR-based development
  • 🧪 Trunk-Based – merge early, deploy often

Let us know what fits your project best!

Some comments may only be visible to logged-in visitors. Sign in to view all comments.