Terminal GuideTerminal Guide

git-flow

Git Tools
macOSLinuxWindows
Shell

Git branching model extension commands.

Official Website

Features

Branch ModelFeature BranchesRelease BranchesHotfix Branches

Installation

Homebrew
brew install git-flow
APT (Debian/Ubuntu)
apt install git-flow
Pacman (Arch)
pacman -S git-flow

Why Use git-flow?

git-flow is a Git extension that implements the branch model proposed by Vincent Driessen. It streamlines team development with a systematic workflow using purpose-specific branches like feature, release, and hotfix.

Systematic Branch Model

Achieve clear development flow with 5 branch types: main, develop, feature, release, and hotfix.

Easy Branch Operations

Complete complex merge operations with a single command. Automate from branch creation to finish.

Release Management

Version management with release branches. Track release history with automatic tagging.

Emergency Fix Support

Handle emergency fixes for production with hotfix branches. Changes are applied to both main and develop.

Branch Model

Git Flow Branch Structure
=.repeat(60)
main*---*-----------*-------*---*(production release)
\ / / /
release \---*---/ / /(release prep)
\ | / /
develop*--*---*---*---*---*---*---*(dev integration)
/ \ / \
feature *-*-* *-*-* *-*(feature dev)
|
hotfix *-*(emergency fix)
BranchPurposeBranch FromMerge To
mainProduction releases--
developDevelopment integrationmainrelease
feature/*New feature developmentdevelopdevelop
release/*Release preparationdevelopmain, develop
hotfix/*Emergency fixesmainmain, develop

Installation

Installation
# macOS (Homebrew)
brew install git-flow

# macOS (AVH Edition - Recommended)
brew install git-flow-avh

# Ubuntu/Debian
sudo apt-get install git-flow

# Fedora
sudo dnf install gitflow

# Windows (Chocolatey)
choco install gitflow-avh

# Windows (May be included with Git for Windows)
# Select git-flow during installation

# Check version
git flow version

The AVH Edition is an extended version of the original git-flow with more features and bug fixes.

Initialization

Initialization
# Initialize git-flow in repository
git flow init

# Set branch names interactively
# Which branch should be used for bringing forth production releases?
#    - main
# Branch name for production releases: [main]
#
# Which branch should be used for integration of the "next release"?
#    - develop
# Branch name for "next release" development: [develop]
#
# Feature branches? [feature/]
# Bugfix branches? [bugfix/]
# Release branches? [release/]
# Hotfix branches? [hotfix/]
# Support branches? [support/]
# Version tag prefix? []

# Initialize with default settings (non-interactive)
git flow init -d

# Check configuration
git flow config

Feature Workflow

Basic Flow

Feature Workflow
# Create new feature branch
# Branch from develop to feature/login
git flow feature start login

# Working...
git add .
git commit -m "feat: add login form"
git commit -m "feat: add authentication logic"

# Finish feature (merge to develop and delete branch)
git flow feature finish login

# Publish feature branch to remote (for team development)
git flow feature publish login

# Pull remote feature branch
git flow feature pull origin login

# Or track remote
git flow feature track login

Feature Commands

CommandDescription
git flow feature start NAMECreate new feature branch
git flow feature finish NAMEFinish feature and merge to develop
git flow feature publish NAMEPublish feature to remote
git flow feature pull origin NAMEPull remote feature
git flow feature track NAMETrack remote feature
git flow feature listList feature branches

Release Workflow

Release Workflow
# Create new release branch
# Branch from develop to release/1.0.0
git flow release start 1.0.0

# Release preparation (version update, final adjustments)
vim package.json  # Update version
git add .
git commit -m "chore: bump version to 1.0.0"

# Finish release
# - Merge to main
# - Create tag (v1.0.0)
# - Merge to develop
# - Delete release branch
git flow release finish 1.0.0

# Push tags
git push origin --tags
git push origin main
git push origin develop

# Publish release branch to remote (for long release preparation)
git flow release publish 1.0.0

# Track remote release branch
git flow release track 1.0.0

Hotfix Workflow

Hotfix Workflow
# Critical bug found in production!
# Branch from main to hotfix/1.0.1
git flow hotfix start 1.0.1

# Fix the bug
git add .
git commit -m "fix: resolve critical login error"

# Finish hotfix
# - Merge to main
# - Create tag (v1.0.1)
# - Merge to develop
# - Delete hotfix branch
git flow hotfix finish 1.0.1

# Push tags and branches
git push origin --tags
git push origin main
git push origin develop

Note:Since hotfix branches from main, fixes are made directly to production code. Fixes are automatically merged to develop as well, maintaining consistency with development code.

Command List

Command List
# Initialization
git flow init [-d]              # Initialize git-flow (-d for default settings)

# Feature
git flow feature start NAME     # Create new
git flow feature finish NAME    # Finish
git flow feature publish NAME   # Publish
git flow feature pull NAME      # Pull
git flow feature track NAME     # Track
git flow feature list           # List
git flow feature delete NAME    # Delete

# Release
git flow release start VERSION  # Create new
git flow release finish VERSION # Finish
git flow release publish VERSION # Publish
git flow release track VERSION  # Track
git flow release list           # List
git flow release delete VERSION # Delete

# Hotfix
git flow hotfix start VERSION   # Create new
git flow hotfix finish VERSION  # Finish
git flow hotfix publish VERSION # Publish
git flow hotfix list            # List
git flow hotfix delete VERSION  # Delete

# Support (long-term support branches)
git flow support start VERSION TAG
git flow support list

# Configuration
git flow config                 # Show configuration
git flow version                # Show version

Best Practices

Keep Feature Branches Small

Split large features into multiple smaller features. Increase merge frequency to minimize conflicts.

No New Features in Release Branches

Only bug fixes and version updates in release branches. New features wait for the next release.

Keep Hotfixes Minimal

Hotfixes are for emergency fixes only. Related improvements should be handled separately in feature branches.

Use Semantic Versioning

Version management in MAJOR.MINOR.PATCH format. MAJOR for breaking changes, MINOR for new features, PATCH for bug fixes.

Comparison with Other Workflows

ItemGit FlowGitHub FlowGitLab Flow
ComplexityHighLowMedium
Release CycleScheduledContinuousFlexible
Suitable ProjectsPackages, version-critical projectsWeb apps, SaaSMulti-environment deployments
Main BranchProduction releases onlyAlways deployableAlways deployable
Develop BranchYesNoNo

Git Flow is suitable for projects with scheduled release cycles (libraries, packages, etc.). For web applications requiring continuous deployment, GitHub Flow may be simpler and more appropriate.

Tips

  • *Don't forget to push to remote after running git flow feature finish
  • *In team development, commonly share branches with feature publish and review with PRs
  • *Many Git GUI tools (GitKraken, Sourcetree, etc.) support Git Flow
  • *Push tags automatically created on release/hotfix completion with git push --tags
  • *When combining with CI, commonly trigger tests on merge to develop branch
  • *AVH version supports squash merge with git flow feature finish --squash

Official Resources

Written by Dai AokiPublished: 2026-01-20

Related Articles

Explore More