0
0
GitConceptBeginner · 3 min read

Release Branch in Gitflow: Definition and Usage

In gitflow, a release branch is a temporary branch created from develop to prepare a new production release. It allows final testing, bug fixes, and versioning before merging into main and develop branches.
⚙️

How It Works

Think of a release branch as a staging area where you polish your product before showing it to customers. When your development work on the develop branch is ready for release, you create a release branch. This branch lets you fix small bugs, update documentation, and prepare version numbers without disturbing ongoing development.

Once everything is ready and tested on the release branch, you merge it into the main branch to mark the official release. You also merge it back into develop to keep new fixes synchronized. After merging, the release branch is deleted because its job is done.

💻

Example

This example shows how to create a release branch, make a fix, and finish the release in gitflow.

bash
git checkout develop
# Create a release branch named 'release-1.0.0'
git checkout -b release-1.0.0

# Fix a bug or update version
# (edit files here)

# Commit the fix
git add .
git commit -m "Fix bug and update version for release 1.0.0"

# Merge release branch into main (production)
git checkout main
git merge --no-ff release-1.0.0

# Tag the release
git tag -a v1.0.0 -m "Release version 1.0.0"

# Merge release branch back into develop
git checkout develop
git merge --no-ff release-1.0.0

# Delete the release branch
git branch -d release-1.0.0
Output
Switched to branch 'develop' Switched to a new branch 'release-1.0.0' [release-1.0.0 abc1234] Fix bug and update version for release 1.0.0 Switched to branch 'main' Merge made by the 'recursive' strategy. Switched to branch 'develop' Merge made by the 'recursive' strategy. Deleted branch release-1.0.0 (was abc1234).
🎯

When to Use

Use a release branch when your project is ready for a new version but needs final polishing before going live. It is helpful when multiple developers continue working on new features in develop while you prepare the release separately.

Real-world use cases include:

  • Final bug fixes and testing before a product launch
  • Updating documentation or version numbers without blocking new feature work
  • Coordinating releases in teams where development and release cycles overlap

Key Points

  • A release branch is created from develop to prepare a release.
  • It allows bug fixes and version updates without affecting ongoing development.
  • After release, it merges into main and develop, then is deleted.
  • Helps teams manage releases and development in parallel.

Key Takeaways

A release branch is a temporary branch from develop to prepare a production release.
It isolates final fixes and versioning from ongoing development work.
After testing, merge the release branch into main and develop, then delete it.
Release branches help teams manage stable releases alongside new feature development.