Git & GitHub Course
Git & GitHub
/
Advanced

Release Branches

Definition

A branch created specifically to prepare for a new production release. It allows the `develop` branch to continue receiving new features for the NEXT release, while the release branch is locked down for bug fixes only.

Explain Like I'm New

Imagine you are building iOS 17. It's almost September. You create a branch called `release-ios17`. From this moment on, NO new features are allowed in iOS 17. Only bug fixes. Meanwhile, the main development team immediately starts building iOS 18 features on the main branch.

Real World Example

Used heavily in mobile app development, desktop software, and open-source frameworks where users have to actively download specific 'Versions' (like Next.js v13.4).

Common Use Cases

  • •Versioned software
  • •QA stabilization periods

Terminal Output

bash / terminal
# Create a release branch off of 'develop' $ git checkout -b release-v2.0 develop # QA tests it, finds a bug, you fix the bug. $ git commit -m "Fix critical crash on startup" # Release day arrives! Merge to main and tag it. $ git checkout main $ git merge release-v2.0 $ git tag v2.0.0 # Don't forget to merge those bug fixes back to develop! $ git checkout develop $ git merge release-v2.0

Interview Questions

basic

  • Are new features allowed on a Release branch?

intermediate

  • Once the Release branch is deployed, what do you do with it?

Flash Cards

Question

New features allowed?

Click to reveal answer
Answer

No. A release branch is in a 'Feature Freeze'. Only critical bug fixes and documentation updates are allowed.

Question

What to do with it?

Click to reveal answer
Answer

You merge it INTO `main` (so production is updated), and you also merge it BACK into `develop` (so all the bug fixes you made aren't lost in future versions).