Gitflow is a proven branching model originally developed by Vincent Driessen. It provides a robust framework for managing features, releases, and hotfixes in software projects. This guide shows you how to set up Gitflow system-wide on macOS.
What is Gitflow?
Gitflow defines a strict branching workflow with two main branches:
- main (or master): Always contains production-ready code
- develop: Integration branch for new features
Additionally, there are temporary branches for:
- Feature branches: For new functionality (branched from develop)
- Release branches: For release preparation (branched from develop)
- Hotfix branches: For critical production fixes (branched from main)
Gitflow Cheatsheet: https://danielkummer.github.io/git-flow-cheatsheet/
Installing Gitflow on macOS
The AVH edition of Gitflow is the actively maintained community version with additional functionality and performance improvements over the original implementation.
Via Homebrew (recommended)
| |
Verification
| |
Using Gitflow in the Terminal
Initialize a Repository
Navigate to your Git repository and initialize Gitflow:
| |
The -d flag accepts all default values (main as production branch, develop as development branch).
Please set the default branch to “develop” (e.g. within Settings of branch on github).
Feature Workflow
Create a new feature branch:
| |
This automatically creates a feature/amazing-feature branch from the current develop branch.
Work on your feature and commit as usual:
| |
Publish the feature branch (for teamwork):
| |
Finish the feature by a PR or if no PR required:
| |
This merges the feature branch into develop and deletes the local feature branch.
Create a release
| |
Please open a PR and merge changes and delete old branch or:
| |
Afterwards, do
| |
Create a hotfix
| |
And push changes
| |
Further Resources
Gitflow AVH Edition on GitHub:
https://github.com/petervanderdoes/gitflow-avh