Release Branches and Hotfixes: Maintain Supported Versions
Why maintain a release branch?
A release branch can stabilize or maintain a supported version while main receives new features. GitHub Flow may be sufficient for one continuously delivered version; multiple supported versions may justify maintenance branches. A classic Git Flow model separates development, release and hotfix lines with more coordination cost. There is no required Git command called git flow in core Git. Choose based on support obligations, not the popularity of a model.
Fix the oldest affected supported line
Scenario C starts at tag v1.0.0 with an ambiguous watering interval. main adds gallery.txt; release/1.x keeps the old content. For this policy fix the oldest affected supported version first on a hotfix branch and review it against release/1.x. After verifying the release snapshot, integrate the same fix forward into main where compatible. Alternatively a team may fix main first and backport with cherry-pick; record the direction and check each target.
git switch -c hotfix/watering release/1.xprintf "Water every 3 days\n" > notes.txtgit add -- notes.txtgit commit -m "Fix watering interval"git switch release/1.xgit merge --ff-only hotfix/wateringgit tag -a v1.0.1 -m "Maintenance fix"Forward integration and verification
In the toy graph the release branch contains only the shared base and the fix. Merging it into main therefore introduces no unrelated maintenance-only change. Real branches may contain target-specific commits; review the diff and use a selective transfer if merging all ancestry would be wrong. Check the old and new release tags, main, and the absence of the new gallery in the maintenance tag. A tag is not a hosted release or deployment.
git switch maingit merge --no-ff --no-edit release/1.xgit show v1.0.0:notes.txtgit show v1.0.1:notes.txtgit show main:notes.txtgit ls-tree --name-only v1.0.1Coordinate hotfix ownership
A hotfix is urgent, not exempt from verification. Record affected versions, source and target commits, checks, approvals, release artifact and deployment outcome separately. Preserve previously distributed tags. Practice: a gallery feature should not enter v1.0.1 just because it exists on main; select only the compatible fix and test both maintained and development lines.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Release Branches and Hotfixes: Maintain Supported Versions — knowledge check
Reason about integration cadence, release scope and team policy.
Why have a maintenance branch?
Where does scenario C fix the bug first?
What should v1.0.1 contain?
What if a maintenance branch has unrelated target-specific changes?
Does creating a tag deploy a release?