GitFlow
Overview
Git Flow is a set of industrial branch management standards. It defines types of branches and flow rules that everyone in medium and large projects can follow. For each branch type, its function, and flow logic, see the following table.
Branch Type | Source | Function | Naming Convention | Merge Target | Lifecycle |
|---|---|---|---|---|---|
master | Automatically created upon repository initialization | Stores stable code of the production environment and is bound to the formal version tag. | master | release/hotfix | Permanent, that is, the branch exists during the project period. |
develop | master | Serves as the main development branch. It integrates completed functions and stores code to be released. |
| feature/release | Permanent |
feature | develop | Used to develop a new feature. Only code to be modified and related to the feature is involved. |
| develop | Temporary and will be deleted after the feature is merged. |
release | develop | Prepared for version release. This branch is only used to fix bugs found during testing, and does not allow adding of new code of features. | NOTE: A version number starts with the prefix v (short for version), followed by major version number, minor version number, and revision number in order.
| master+develop | Temporary and will be deleted after the version is released. |
hotfix | master | Used for quick fixing of bugs in the production environment. This branch is prior to the feature branch. |
| master+develop | Temporary and will be deleted after the bug fixes are merged. |
Advantages
- Clear structure and standard process
Git Flow organizes branches by clear roles: master (for production), develop, feature, release, and hotfix (for urgent bug fixes). It is a logical workflow that reduces confusion and helps keep the team's development process aligned.
- Better isolation and lower risks
- Developing new features in feature branches does not affect the develop branch.
- Testing and fixing in release branches before version release avoids interference with daily development.
- Fixing bugs in the production environment through hotfix branches does not interrupt the normal development process.
- Clear versioning and strong traceability
- Binding the master branch with version tags (for example, v1.0.0) facilitates quick locating of production code.
- Clear branch names and merge records make it easy to trace code commit and fixes, facilitating troubleshooting.
Disadvantages
- Not flexible enough for quick iterations
For agile and continuous deployment projects, release branches may slow down the release pace. Iterations, for example, of small functions, have to go through the whole process from feature to develop, release, and master.
- Complex process and high learning cost
- It may take a long time for beginners to master the branch types, sources, target branches to merge to, and lifecycles.
- In routine operations, there are many steps for creating, merging, and deleting branches, which increases management costs.
- Redundant branches and high maintenance cost
Branches will pile up and become difficult to manage if the temporary branches (such as feature, release, and hotfix) are not cleared up in time, especially in long-term projects.
- Not suitable for small projects or teams of 3 to 5 members
For small teams or short-term projects, the strict Git Flow process can be overly complex. Using just master and develop branches is usually sufficient.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot
