Mastering Git Flow: A Complete Guide to Branching, Releases, and Commits
This article explains the Git Flow branching model, its variations, detailed workflow steps, essential tools, and best practices for commit messages, providing a comprehensive guide for teams to manage collaborative development efficiently.
1. Introduction to Git Flow
Git Flow defines a strict Git branching model for managing collaborative development in large projects, originating from Vincent Driessen's "A successful Git branching model". It has three main variants: the original Git Flow, Github Flow (a simplified version for continuous delivery), and GitLab Flow (a combination of both).
2. Git Flow Process
The original Git Flow is suited for traditional versioned releases. Its core branches include two long‑living branches: develop (development) and master (production). The model also defines feature/xxxx, hotfixes/xxxx, and release/xxxx branches.
The
master: production code, always deployable.
develop: integration branch for the latest feature work.
feature: new feature branches, named feature/xxxx.
hotfixes: urgent bug‑fix branches, named hotfixes/xxxx.
release: stable release branches, named release/xxxx.
Develop is the upstream branch; when features are complete, a release branch is created from develop, tested, and finally merged into master for deployment.
3. Git Flow Tools
Because manual Git commands can be cumbersome, the git‑flow extension automates the workflow. It provides high‑level commands that follow Driessen's model. Another tool, git‑extras, offers a broader set of Git utilities.
4. Git Commit Message Guidelines
A consistent commit message improves code review and auditing. The widely adopted Angular convention uses the format:
<type>(<scope>): <subject>
<body>
<footer>The first line includes:
type: e.g., feat, fix, docs, style, refactor, test, chore.
scope: the affected area, such as a module or component.
subject: a brief description.
The body provides detailed information, while the footer can contain a BREAKING CHANGE: note, issue closures like Close #9527,#9528, or references such as refs ISSUE. For rollbacks, use revert: followed by the original commit details.
5. Commit Message Generation Tools
Tools like commitizen-cli (run with git cz) generate Angular‑style messages, but require Node.js. An alternative shell‑based Git‑toolkit offers an interactive git ci command to produce the same format.
6. Integrating Git Flow with GitLab
All operations described are local; in practice teams use GitLab for collaboration. The typical GitLab workflow includes:
6.1 Developing Features
Start a feature locally: git flow feature start xxxx.
Publish the feature: git flow feature publish xxxx.
Create a merge request to develop on GitLab.
Run CI, code review, and quality checks.
After approval, merge into master and develop as appropriate.
Deploy to a test environment for verification.
6.2 Creating a Release
Start a release branch: git flow release start xxxx.
Publish the release: git flow release publish xxxx.
Perform thorough testing and fix any issues.
Open merge requests to both master and develop.
After merging, tag the release on master and deploy to production.
Merge any post‑release changes back into develop.
6.3 Hotfixes
Create a hotfix from master: git flow hotfix start xxxx.
Push changes, then merge the hotfix into both master and develop.
Tag the hotfix on master and deploy.
Source: https://mritd.me/2017/09/05/git-flow-note/
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
MaGe Linux Operations
Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
