Designing a Hotfix Path
This lesson explains how to plan a fast route for urgent fixes for each branch strategy.
Learning outcomes
After completing this lesson, you will be able to:
- Explain why a hotfix path is planned in advance.
- Describe the path for each branch strategy.
- Decide which checks to keep.
- Identify alternatives to a hotfix.
Why plan in advance
During an incident, people are under pressure, and they tend to skip steps. If no route has been agreed, someone may change production by hand, and that change may be overwritten by the next release. A hotfix path is a planned route for high-priority fixes. It answers three questions in advance: where does the fix start, which checks are mandatory, and how does the fix return to main?
The path for each branch strategy
Trunk-based development
If main is always deployable, a fix can simply go through main and the normal pipeline. This is the ideal: a team that can deploy within minutes has no need for a special route. If main contains changes that are not ready, they should be hidden behind flags, which keeps this path open.
Release branches
If production runs from a release branch or tag, and main has moved on, a hotfix must be based on the released code. Microsoft's release flow recommends fixing main first, then cherry-picking to the release branch, so that the fix can never be forgotten.
# Fix main first through a normal pull request, then:
git switch release/2.3
git switch -c hotfix/2.3.1
git cherry-pick -x 7c9e2f1
git push origin hotfix/2.3.1
# Open a pull request into release/2.3, then tag the result
git tag -a v2.3.1 -m "Hotfix for payment timeout"
git push origin v2.3.1If a fix cannot go to main first, because the urgent problem exists only in an old version, a branch is created from the production tag, and the change is brought forward to main afterwards. -x records the source commit in the message, which helps traceability.
Rollback as an alternative
A hotfix is not always the fastest option. If a recent release caused the problem, rolling back through a slot swap, or turning off a feature flag, may restore service in seconds, leaving time to prepare a proper fix.
Where the hotfix goes
Keeping safety on the fast path
A hotfix pipeline should be shorter, but it should keep what matters. A reasonable approach is to retain code review by one person, unit tests, secret and dependency scans, and health checks after deployment, while skipping long-running load tests or slow regression suites that do not relate to the change. Deploying to a canary or a staging slot first is still worthwhile when the time is available.
Governance needs to be planned too. Approvers should be available out of hours, so an on-call group can be named on the environment. Any emergency bypass should be logged, and work should be recorded in a work item, so that the change is visible in later reviews. A blameless post-incident review should then look at how the defect escaped, and it should add a test that would have caught it.
Keep or skip on the hotfix path?
The hotfix sequence
The following sequence summarizes a complete path for a team using release branches.
-
Assess
Decide between rollback, flag change and hotfix.
-
Fix
Make the change with a regression test, on main first when possible.
-
Review
Use a short review with the essential checks.
-
Deploy
Deploy to a slot or canary, and then to production.
-
Verify
Confirm health with telemetry.
-
Merge back
Ensure that the fix is on main and on any other supported branch.
-
Learn
Run a post-incident review and record follow-up work.
The following diagram compares fixing a defect only on a release branch with fixing it on main first, which explains why a fixed defect came back.

A complete hotfix path
A lost fix
Last month, a team fixed a critical defect directly on a release branch. The defect has now reappeared in a new release from main. What process change prevents this?
The team should require fixes to go to main first, and be cherry-picked to the release branch, which means that the fix is in all future releases. A regression test added with the fix would also fail if the defect returned. A longer test phase might catch it, but it would not address the cause, and adding more release branches would make the problem worse.
What should a hotfix branch start from if main contains unreleased work?
Show answer
The commit or tag in production, because the fix must not bring unreleased work with it.
Exam Tips
Remember for the exam
- Define the hotfix path before an emergency.
- Start from the code running in production, and always bring the fix to main.
- Release flow fixes main first, then cherry-picks.
- Keep review, unit tests and scans; skip long-running suites.
- Consider rollback or a flag first; a fix is not always the fastest recovery.