GitHub Revert Pull Request: Undo a Merged PR Safely (2026 Guide)

Published February 16, 2026 · 9 min read

If a pull request is already merged and causing problems, the safest rollback is usually revert, not reset. On GitHub, the merged PR page often has a Revert button that creates a rollback PR for you.

When that button is missing, you can still revert safely with CLI. The exact command depends on how the PR was merged: merge commit, squash merge, or rebase merge.

⚙ Quick links: Revert Commit on GitHub (UI + CLI) · GitHub Revert Button Missing Fix · GitHub Revert Conflict Resolution · GitHub Revert-the-Revert Guide · Protected Branch Revert + Merge Queue · Revert Merge Commit (-m explained) · Wrong Mainline Parent Recovery · Git Revert Complete Guide · Undo Pushed Commit Guide · Git Undo Decision Guide · Git Commands Cheat Sheet

Table of contents

  1. Quick decision: which rollback path to use
  2. Revert a merged PR in GitHub UI
  3. When the Revert button is missing
  4. CLI fallback by merge type
  5. Verification and conflict handling
  6. FAQ

1. Quick decision: which rollback path to use

Situation Use this Why
Merged PR has a visible Revert button GitHub UI revert flow Fastest and review-friendly: GitHub opens a rollback PR automatically.
PR merged as a merge commit git revert -m 1 <merge-hash> Required for merge commits because parent selection must be explicit.
PR merged with squash git revert <squash-commit-hash> Squash creates a normal single commit; no -m needed.
PR merged with rebase / fast-forward git revert --no-commit OLDEST^..NEWEST Rebase/ff produces multiple normal commits, so revert the range.
Rule: on shared branches, prefer revert over reset. Revert creates new commits and avoids force-push repair work for teammates.

2. Revert a merged PR in GitHub UI

  1. Open the merged pull request page in GitHub.
  2. Click Revert.
  3. GitHub creates a new branch and rollback pull request.
  4. Run CI checks, request review, then merge the rollback PR.

This keeps your audit trail clean: original PR + explicit rollback PR.

3. When the Revert button is missing

The button may be unavailable even when rollback is possible. Common reasons:

Important: "Button missing" does not mean "cannot revert." It usually means "revert manually with CLI."

If you want a dedicated checklist just for this exact scenario, use GitHub Revert Button Missing Fix Guide.

4. CLI fallback by merge type

Step 1: sync local main

git switch main
git pull --ff-only

Step 2A: PR was merged with a merge commit

# Confirm parent order
git show --no-patch --pretty=raw <merge-hash>

# Keep parent 1 (usually main), undo merged side
git revert -m 1 <merge-hash>
git push origin main

Step 2B: PR was squash-merged

git log --oneline --decorate -n 30
git revert <squash-commit-hash>
git push origin main

Step 2C: PR was rebase-merged (multiple commits)

# Revert all PR commits as one rollback commit
git revert --no-commit OLDEST^..NEWEST
git status
git diff --staged
git commit -m "Revert merged PR #123"
git push origin main

Undo the rollback if needed

git log --oneline -n 10
git revert <rollback-commit-hash>
git push origin main

5. Verification and conflict handling

Before push

git status
git log --oneline --decorate -n 8
git show --name-only HEAD

If revert stops with conflicts

# resolve files, then
git add <resolved-files>
git revert --continue

# if you need to cancel
git revert --abort

After merge/push, validate production behavior and monitor error/latency dashboards before deciding whether additional rollback commits are required.

6. FAQ

Can I revert a PR without force pushing?

Yes. Revert creates new commits. Force push is usually unnecessary for merged PR rollback.

Should I revert the PR or revert individual commits?

If you need to undo the whole PR, revert the merge/squash/range as one rollback unit. Revert individual commits only when partial rollback is intentional.

Why did git revert -m 1 fail?

Usually wrong commit type (not a merge commit), incorrect parent choice, or conflicts requiring manual resolution.

Can I re-merge the same PR branch later?

Often yes, but you may need to revert the rollback first or add fresh commits, depending on merge history.

Where can I learn the full parent-selection details?

Read Git Revert a Merge Commit for deeper -m parent guidance.

Related Resources

Revert a Commit on GitHub UI and CLI workflows for commit and PR rollback basics. Revert Button Missing Fix Guide Exact diagnostics and rollback commands when GitHub shows no Revert button. GitHub Revert-the-Revert Guide Bring back rolled-back PR changes safely with UI/CLI recovery steps. Protected Branch Revert Guide Rollback playbook for PR-only branches and merge queue repos. Revert Merge Commit Guide Deep dive on git revert -m and re-merge strategy. Undo Pushed Commit Guide Copy/paste rollback recipes for shared branches. GitHub Pull Requests Guide Merge strategies, branch protection, and review workflows. Git Commands Cheat Sheet Quick daily reference for revert, reset, restore, log, and more.