Git Hotfix in Production: The GitHub Flow Emergency Playbook
It's Friday 5pm. Your Slack lights up: "Production checkout is broken. Users can't complete orders." Your feature branch is halfway done. Your stomach drops. What do you do?
The answer with GitHub Flow is simpler than you think, and there's one rule that matters above all others.
The One Rule: Always Branch from main
Do NOT branch from your feature branch. main is what's running in production. Your feature branch may have unreviewed code that was never deployed. Branching from it would silently ship that code alongside your hotfix.
The Hotfix Playbook (Step by Step)
Step 1: Leave your feature branch, switch to main
git checkout main
git pull origin mainStep 2: Create a hotfix branch from main
git checkout -b fix/DEV-911-null-crash-on-checkoutStep 3: Make the minimal fix. ONLY the fix.
Resist the urge to refactor "while you're there." Every extra line is a risk at 5pm Friday. If you notice something else broken, file a separate ticket and fix it later.
git add src/checkout/CartSummary.tsx
git commit -m "fix(checkout): prevent null crash when cart is empty"Step 4: Open a PR, label it as a hotfix and request urgent review
## What
Fix null crash on checkout when cart is empty.
## Why
🚨 HOTFIX, production is down. Ticket: DEV-911
Users hitting /checkout with an empty cart get a 500 error.
## How to Test
1. Add item to cart → checkout → works ✅
2. Go directly to /checkout with empty cart → redirect, no crash ✅
## Risk
Low, single null-check added, no logic changes.Step 5: Merge to main and deploy
git checkout main
git pull origin main
git merge fix/DEV-911-null-crash-on-checkout
git push origin main
# Trigger your CI/CD deploy (Vercel, GitHub Actions, etc.)Step 6: Pull the fix into your feature branch so you don't conflict later
git checkout feat/DEV-42-user-login
git merge main
# Resolve any conflicts, then continue your feature workAcceptance Criteria
A hotfix is done correctly when:
☐ Hotfix branch was created from main, not from a feature branch
☐ PR diff contains only the fix, no unrelated changes
☐ Automated tests pass before merge
☐ At least one team member reviewed and approved
☐ Deployed and verified in production within team SLA
☐ All active feature branches updated from main after the hotfix merges
Common Mistakes
❌ Branching from your half-done feature branch, you ship unreviewed code to production.
❌ "While I'm here" changes, scope creep under pressure causes more bugs than it fixes.
❌ Skipping review because it's urgent, a second pair of eyes catches mistakes you're too stressed to see.
TL;DR
Branch from main. Fix only what's broken. Review. Deploy. Update everyone's branches. The pressure is real. The process keeps you from making it worse.
Recommended for you
- CollaborationClaude CodeFigma
Cutting Designer-Engineer Handoff From Two Weeks to Two Hours
The bottleneck is not engineering speed. It is the loop between intent and working interface. Claude Design compresses that loop, but only if you use it the way that actually pays off.
- CollaborationClaude CodeAmp
Why I Stopped Running Parallel Agents in the Same Repo
Three agents in one workspace collide on branches, stash each other's state, and inherit leftover files. Sibling worktrees plus a fresh base branch fix all three. Here is the setup.
- CollaborationHerdrClaude Code
I Tried Running Four Agents in Parallel. Twenty Minutes of Silence Is Where It Broke.
Three agents pushed branches on schedule. The fourth stalled on a quota ceiling and I did not notice for twenty minutes. The fix was not better agents. It was inspectable ones.
- CollaborationHerdrClaude Code
Why Your Coding Agent Terminal Becomes Unreadable Past Three Panes
Two agents fit on one screen. Three forces you to switch. Four means you stop reading the output. The terminal is not the right unit for parallel agents.
Enjoyed this article?
Subscribe for new articles. No spam. Unsubscribe anytime.
By subscribing you agree to receive the newsletter. See the Privacy page.