| English | 中文 |
Original links:
The real problem for many teams is often unclear branch semantics:
master really the production version?develop contain unreleased code?The value of Gitflow lies in clarifying these roles. It is especially suitable for teams with explicit release cycles, fixed deployment windows, and longer testing periods.
| Branch | Role |
|---|---|
master / main |
Stays strictly aligned with the live production version |
develop |
Daily development integration branch |
feature/* |
Feature development branches |
release/* |
Testing and release preparation for a specific version |
hotfix/* |
Emergency fixes for production issues |
The basic rule is: Do not modify the mainline and development integration branch directly; features, releases, and fixes are all handled through their respective branches.
develop -> feature/x -> develop -> release/1.2.0 -> main -> tag
Operational meaning:
feature/x from developdevelop once the feature is completerelease/* from developrelease/*release/* is merged into main and taggedrelease/* into developProduction issues take priority by creating a hotfix/* from the production baseline:
main -> hotfix/1.2.1 -> main -> tag
\-> develop
Key points:
developdevelop already has unreleased code, but a small feature needs urgent releaseIn this case, do not branch directly off develop, as it might carry over content that shouldn’t be released.
A safer approach is to create a branch from main or the production tag, release it like a hotfix or emergency release, and then synchronize the changes back to develop.
It is best to identify dependencies early during the requirements breakdown phase.
If they are already separated, the team needs to quickly decide whether to merge them into a single feature branch or establish a common base branch, avoiding long-term, mutual cherry-picking between the two branches.
Rebase can be used for cleaning up commits locally.
Once a branch has been published to the shared repository—especially if others have already based continued development on it—do not arbitrarily rebase and force push.
Suitable for:
Not suitable for:
The focus of Gitflow is constraints:
If a team adopts Gitflow, it is best to write these rules into the team conventions and use branch protection, PR templates, and CI checks to reduce human omissions.