Skip to content

Git Flow

一句话解释

Git Flow 是 branching model 使用 dedicated 分支 for features, 发布, and hotfixes, providing structured workflow for 发布.

用大白话说

Git Flow is a branching model proposed by Vincent Driessen that defines specific branch types and rules for how they interact. It provides a structured workflow for projects with scheduled releases.

The branch types in Git Flow:

  • main: production-ready code, always deployable. Tagged with version numbers.
  • develop: integration branch for features. Latest delivered development changes.
  • feature/*: branches off develop for new features. Merged back into develop.
  • release/*: branches off develop for release preparation. Merged into both main and develop.
  • hotfix/*: branches off main for urgent production fixes. Merged into both main and develop.

Git Flow provides clear structure but can be heavyweight for small teams or continuous deployment. Simpler alternatives include GitHub Flow (feature branches + PRs to main) and Trunk-Based Development (everyone commits to main with short-lived branches).

示例

bash
# Using the git-flow extension (if installed)
git flow init
git flow feature start login
git flow feature finish login
git flow release start 1.0.0
git flow release finish 1.0.0

# Or manually:
git checkout -b feature/login develop
# ... develop feature ...
git checkout develop
git merge --no-ff feature/login
git branch -d feature/login

Git Flow uses structured 分支类型: 主要, develop, feature, 发布, hotfix.

相关术语

相关资源

相关课程

解读错误信息

用大白话解释常见错误——什么意思、为什么发生、如何修复。

查看错误

← 返回术语表