Skip to content

Rolling back by reverting the merge commit

With the suspect PR identified, the engineer uses GitHub's Revert button to generate a clean revert PR prefixed [hotfix]. The revert PR is reviewed, merged and deployed, then a comment on the original PR explains the revert and the next steps.

Category
Tags
githubrollbackreverthotfixmerge-commit
What and why
The observed behaviour and the reasoning behind it.
Behaviour
Reasoning
Cause and effect
What initiates this pattern and what it produces.
Trigger
Outcome
Standard operating procedure
Step-by-step instructions to reproduce this pattern.
1

GitHub

On the suspect PR's main page, scroll to the merged status banner near the bottom and click 'Revert'.

The Revert button only appears on PRs that were merged using the Merge or Squash strategy and only on the default branch. If the PR was merged to a release branch or rebased, the button is absent and you will need to fall back to a manual git revert.

Expected: GitHub creates a new branch named revert-<n>-<original-branch> and opens the new PR creation page pre-populated with the inverse diff.

2

GitHub

Edit the PR title to prefix it with [hotfix] and reference the PagerDuty incident ID in the body.

[hotfix] is the convention that triggers the deploy pipeline's abridged test suite. The PD incident ID in the body is the citation that links this revert PR to the post-mortem. Example title: '[hotfix] Revert #4892, retry policy regression on api-gateway'.

Expected: The revert PR title starts with [hotfix] and the body links the PagerDuty incident.

3

GitHub

Request review from the original PR author and from one other engineer on the on-call rotation.

The original author understands the change best and can confirm the revert is the correct shape. The second on-call reviewer adds a check on a sleep deprived 2am decision. Avoid requesting from the wider team for a hotfix, parallel reviewers slow the merge.

Expected: Two reviewers are requested on the revert PR with their avatars in the sidebar.

4

GitHub

Wait for CI to complete on the revert PR.

Even with the [hotfix] abridged suite, the deploy gating tests must pass. Skipping CI on a revert is a regular cause of compounding incidents because the revert itself can fail to build or to run migrations in reverse. If CI fails on the revert, stop and switch to the forward fix pattern.

Expected: All required checks on the revert PR are green.

5

GitHub

Merge the revert PR using the 'Merge' button, not Squash.

Merge preserves the revert commit's link to the original merge commit, which the GitHub UI uses to render the revert relationship on both PRs. Squash flattens that link and the audit trail becomes harder to follow in the post-mortem.

Expected: The revert PR is merged to the default branch and the deploy pipeline has started.

6

GitHub

Wait for the deploy to complete and the new release tag to appear on the Releases page.

Do not close the PagerDuty incident yet. Merging the revert is not the same as the revert reaching production. The deploy can fail, the rollout can stall and the page can re-fire. Wait for the green checkmark on the new release before declaring success.

Expected: The Releases page shows a new release tag for the revert with a green deploy status.

7

GitHub

Open the original PR and post a comment explaining the revert and the path forward.

Example: 'Reverted by #4901 due to PD-PT4ZXKR. Will reopen for forward fix once we understand why the new retry policy caused a 5xx spike on api-gateway.' Leave the original PR open. Closing it removes it from the team's followup list and the forward fix loses its origin.

Expected: The original PR has a new comment with the revert PR link and the original PR remains in Open status.

Related patterns
How this pattern connects to other patterns in the library.
Supporting actions
Actions that provide evidence for this pattern.
Reverted api-gateway #4892 via #4901, [hotfix] tag, deploy green
Revert PR for checkout-service #5021 merged, original kept open
Reverted billing-worker #3814 with merge commit graph intact
Posted forward-fix note on api-gateway #4892 after revert
Requested review on revert from #2211 author and Marco for second pair
Metadata
Timestamps and identifiers.
EvidenceObserved 19 times across 4 connections
ApplicationsGitHub
First seen2 Feb 2026, 13:24
Last seen5 May 2026, 18:09
Questions

Frequently asked questions

Speak to the founder

Henry Denton, founder of FusedFrames

Get a demo. Watch a live capture, then an AI agent query the result.

Ask anything. Pricing, security or integrating with your stack.

No purchase obligation

Start capturing

Record in minutes. Install once and work as normal.

Plug AI agents in. One API call from any AI agent stack.

Refund on unused credits if you cancel