🧠What is Git Flow? Git Flow is a branching model created by Vincent Driessen. It organizes work into different branch types , each wi...
🧠What is Git Flow?
Git Flow is a branching model created by Vincent Driessen.
It organizes work into different branch types, each with a clear purpose.
Here’s the structure:
| Branch | Purpose |
|---|---|
main | Always production-ready code |
develop | Ongoing development (integration branch) |
feature/* | New features |
release/* | Preparing a new version for production |
hotfix/* | Urgent fixes for production issues |
support/* | (Optional) Long-term maintenance branches |
⚙️ Installing Git Flow
If you’re on Windows, install it like this (after Git is installed):
🪟 Windows
-
Open Git Bash.
-
Run:
Git Flow is now ready — this initializes the workflow structure in your repo.
🚀 Git Flow Command Guide (with Examples)
Let’s go through the main commands you’ll use 👇
🟩 1. git flow init
Purpose: Initializes Git Flow in your repository.
Command:
You’ll be asked a few questions:
-
Branch name for production releases? →
main -
Branch name for "next release"? →
develop -
Prefix for features, releases, etc. (press Enter to accept defaults)
After that, Git Flow will:
-
Create
developfrommain -
Set up prefixes like
feature/,release/, andhotfix/
✅ Now your repo has:
🟨 2. git flow feature start <name>
Purpose: Start a new feature branch from develop.
Example:
This creates and switches to a new branch:
You can now code your feature.
After finishing the feature:
🟦 3. git flow feature finish <name>
Purpose: Finish your feature and merge it into develop.
Example:
Git Flow will:
-
Merge
feature/login-page→develop -
Delete the feature branch
🟪 4. git flow release start <version>
Purpose: Prepare a release branch from develop.
Example:
This creates a branch:
You can now:
-
Update version numbers
-
Do final testing, bug fixing, etc.
When ready to release:
This will:
-
Merge
release/v1.0→main -
Tag the release as
v1.0 -
Merge
release/v1.0→develop -
Delete the release branch
🟥 5. git flow hotfix start <name>
Purpose: Create a quick fix for production directly from main.
Example:
You fix the bug and commit:
Finish the hotfix:
Git Flow will:
-
Merge fix into
main -
Tag a new release (e.g.
v1.0.1) -
Merge fix back into
develop -
Delete the branch
🧩 6. (Optional) git flow support start <name>
Used for long-term maintenance versions (rare).
Example:
🧠Summary Table
| Command | Description | Merges Into |
|---|---|---|
git flow init | Initialize Git Flow structure | — |
git flow feature start <name> | Start new feature | From develop |
git flow feature finish <name> | Merge feature | Into develop |
git flow release start <version> | Start release prep | From develop |
git flow release finish <version> | Merge release | Into main + develop |
git flow hotfix start <name> | Start urgent production fix | From main |
git flow hotfix finish <name> | Merge hotfix | Into main + develop |
💻 Example Real Workflow
COMMENTS