gh pr merge Merge a pull request
Merges a pull request on GitHub using the method you choose: a merge commit, a squash, or a rebase. It can also delete the branch afterwards.
Synopsis
gh pr merge [NUMBER | URL | BRANCH] [FLAGS]
Common options
| Option or form | What it does |
|---|---|
-m, --merge | Create a merge commit |
-s, --squash | Squash all commits into one |
-r, --rebase | Rebase the commits onto the base branch |
-d, --delete-branch | Delete the branch after merging |
--auto | Merge automatically once required checks pass |
--admin | Merge even if requirements are not met (needs permission) |
Examples
gh pr merge 42
gh pr merge 42 --squash --delete-branch
gh pr merge 42 --auto --squash
gh pr merge --merge
Notes
- A repository may allow only some of the methods. Merging is final, so check gh pr checks first.
- Merging does not update your local main. Run git switch main and git pull afterwards.
- Use gh pr review --approve to approve before merging.
See also
Last reviewed 2026-10-09.