Interview Prep/Git & GitHub/Branching Strategies and Releases

A deployment broke production. Do you revert in Git or roll back the deployment first?

BeginnerScenarioBranching Strategies and Releases
Answer

Situation read → Speed of recovery comes first; code history clean-up second.

What I'd do →

  1. Roll back the deployment to the previous known-good artifact (redeploy the earlier tag).
  2. Stop the bleeding, then open an incident record.
  3. Revert the bad commit on main: git revert <sha>, so the next deploy does not reintroduce it.
  4. Fix properly with a test, and re-release.

Why → Rolling back an artifact takes minutes. Code fixes take longer and need review.

Interview tip → If main stays broken after a rollback, the next deploy brings the bug back.

All Git & GitHub questions Roadmap: Git & GitHub

More on Branching Strategies and Releases