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 →
- Roll back the deployment to the previous known-good artifact (redeploy the earlier tag).
- Stop the bleeding, then open an incident record.
- Revert the bad commit on
main:git revert <sha>, so the next deploy does not reintroduce it. - 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.
More on Branching Strategies and Releases
An eight-person team deploys several times a day. Which branching strategy do you recommend?IntermediateWhen would you choose GitFlow over trunk-based development?IntermediateIn trunk-based development, a feature will take three weeks. How do you merge it daily without exposing it?IntermediateYou are cutting a release. How do you manage the release branch and late fixes?IntermediateShould releases use lightweight or annotated tags?BeginnerA release tag was placed on the wrong commit and has been published. What do you do?Intermediate