Why Rollbacks Matter
- Not every bug can wait for a patch.
- Rollback = restore previous known-good version.
Rollback Approaches
- Infra-based (Blue/Green) – Switch back to old version instantly.
- Git-based Rollback:
# Revert last commit git revert HEAD # Deploy again git push origin main
- Artifact-based Rollback – Redeploy old Docker image or build.
kubectl rollout undo deployment my-app
Hotfix Workflow
- Special workflow for urgent production fixes.
Git branching example:
main │ ├── feature/login │ └── hotfix/fix-payment-crash
Steps:
- Branch from main: git checkout -b hotfix/fix-payment
- Apply fix + tests.
- Deploy directly to production.
- Merge hotfix back into main + develop.
Best Practices
- Automate rollback deployment.
- Keep monitoring alerts → rollback if KPIs spike.
- Separate hotfix branch policy in Git workflow.
- Document incident post-mortem after rollback.