Git Flow is a Git branching strategy. It defines how you create and use branches while developing features, fixing bugs, and releasing versions.
The basic idea is:
main
│
├── develop
│ │
│ ├── feature/login
│ ├── feature/tasks
│ └── feature/profile
│
└── release / hotfixMain branches
main
Contains production/released code.
main
↓
what users getdevelop
Contains the latest development work before it is released.
develop
↓
next versionFeature branch
When implementing a feature:
git checkout develop
git checkout -b feature/loginYou work on:
feature/loginThen merge it into develop:
feature/login
↓
developRelease branch
When you’re preparing a new version:
develop
↓
release/1.2.0You use the release branch for final testing, bug fixes, version numbers, etc.
Then:
release/1.2.0
↓
mainand usually also merge the fixes back into develop.
Hotfix branch
If production has a critical bug:
main
│
└── hotfix/login-bug
↓
mainAfter fixing it, you also merge the fix into develop.
The complete flow
feature/login
↗
develop ────────────────→
│
│
└────→ release/1.2.0 ───→ main
↑
hotfix/bugImportant
Git Flow is not Git itself.
Git provides:
branches
commits
merges
tagsGit Flow is a recommended workflow for using those features.
Also, Git Flow is not the only workflow. Modern teams often use GitHub Flow or trunk-based development, which are usually simpler.
For a small personal project, you probably don’t need full Git Flow. A simpler approach like:
main
↑
feature/xxxis often enough.