Why Rollbacks Matter

  • Not every bug can wait for a patch.
  • Rollback = restore previous known-good version.

Rollback Approaches

  1. Infra-based (Blue/Green) – Switch back to old version instantly.
  2. Git-based Rollback:
# Revert last commit
git revert HEAD

# Deploy again
git push origin main
  1. 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:

  1. Branch from main: git checkout -b hotfix/fix-payment
  2. Apply fix + tests.
  3. Deploy directly to production.
  4. 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.