gh pr merge

Merge a pull request

What it does

gh pr merge merges a pull request in one of three ways: --merge with a merge commit, --squash as a single commit, --rebase commit by commit on top of the target branch. With no flag gh asks. Which ways are allowed is set in the repository settings.

--delete-branch deletes the branch on GitHub and locally, and switches you to the target branch. --auto turns on auto-merge: the PR merges by itself once the required checks pass, if the repository allows it.

Syntax

gh pr merge <number> --merge|--squash|--rebase
gh pr merge <number> --squash --delete-branch
gh pr merge <number> --auto --squash

Examples

Related commands

Practise · All commands