Open Source · MIT

Clean Flow 🌿

A lightweight Git workflow designed to keep the main branch stable while allowing completed work to integrate through a dedicated dev branch. Simpler than Git Flow, more structured than GitHub Flow.

Ship through dev. Keep main clean.

The Core Model

Three branch types. One clear flow. That's it.

🔀
feature/*
Short-lived branches for new work
squash merge
🔧
dev
Integration branch
merge commit
🏠
main
Stable, production-ready

Branch Roles

Every branch has a clear purpose.

🏠

main

The stable branch. Contains production-ready or release-ready code. Changes only arrive here from dev. Never commit directly.

🔧

dev

The integration branch. Collects completed feature work before release. Feature branches are created from here and PRs target here.

🔀

feature/*

Short-lived branches for new features, bug fixes, docs, tests, refactoring, and maintenance. Deleted after merge.

Quick Start

Get up and running with Clean Flow in seven steps.

1

Sync the Latest Dev

Make sure your local dev branch is up to date.

git checkout dev && git pull origin dev
2

Create a Feature Branch

Feature branches always start from dev.

git checkout -b feature/user-authentication
3

Work and Commit

Keep commits focused and related to one logical change.

git add . && git commit -m "add user authentication"
4

Keep Updated

Rebase against the latest dev before submitting.

git fetch origin && git rebase origin/dev
5

Open a PR into Dev

Push and open a pull request targeting dev.

git push -u origin feature/user-authentication
6

Squash Merge

When approved, squash merge into dev. Multiple commits become one clean logical commit.

7

Promote to Main

When dev is stable, merge dev into main using a merge commit.

git checkout main && git merge dev && git push origin main

Branch Naming

Short, descriptive, and prefixed by purpose.

feature/
New features and functionality
feature/user-authentication
fix/
Bug fixes
fix/cart-total-rounding
docs/
Documentation changes
docs/installation-guide
chore/
Maintenance and dependency updates
chore/update-dependencies
test/
Test additions and changes
test/payment-service
refactor/
Code refactoring
refactor/api-client

Merge Strategy

Two simple rules for a clean history.

Feature → dev
Squash Merge
A B C  becomes  S

Keeps feature history compact. Removes noisy WIP commits. One logical commit per feature.

dev → main
Merge Commit
dev  —merge—>  main

Preserves the boundary between integration and stable history. Makes promotion clear.

How It Compares

Clean Flow sits between GitHub Flow and Git Flow.

GitHub Flow Clean Flow Git Flow
Integration branch None dev develop
Release branches No No Yes
Hotfix branches No No Yes
Feature target main dev develop
Complexity Low Medium High

AI Integration

Teach your AI assistant Clean Flow in one copy-paste.

GitHub Copilot

Add branch workflow instructions to your project.

mkdir -p .github/instructions
curl -o .github/instructions/copilot.instructions.md \
  https://raw.githubusercontent.com/wgtechlabs/clean-flow/main/examples/copilot.instructions.md

AI Agents

For Codex, Claude, Cursor, Windsurf, and more.

curl -o AGENTS.md \
  https://raw.githubusercontent.com/wgtechlabs/clean-flow/main/examples/AGENTS.md

The Rules

Everything you need to remember.

Keep main stable
Use dev as the integration branch
Create feature branches from dev
Target pull requests to dev
Squash merge feature branches into dev
Merge dev into main when stable
Delete feature branches after merge
Never commit directly to main
Avoid direct commits to dev
Keep feature branches short-lived
Sync before starting new work
Update branches before submitting
Protect main and dev