gh-pr-merge - Man Page
Merge a pull request
Examples (TL;DR)
- Merge the pull request associated with the current branch interactively:
gh pr merge - Merge the current branch into the specified pull request:
gh pr merge pr_number [-m|--merge] - Squash and merge a pull request, then delete the branch:
gh pr merge pr_number [-sd|--squash --delete-branch] - Rebase and merge:
gh pr merge pr_number [-r|--rebase] - Enable auto-merge (squash):
gh pr merge pr_number --auto [-s|--squash] - Merge with admin privileges (if allowed):
gh pr merge pr_number --admin
Synopsis
gh pr merge [<number> | <url> | <branch>] [flags]
Description
Merge a pull request on GitHub.
Without an argument, the pull request that belongs to the current branch is selected.
When targeting a branch that requires a merge queue, no merge strategy is required. If required checks have not yet passed, auto-merge will be enabled. If required checks have passed, the pull request will be added to the merge queue. To bypass a merge queue and merge directly, pass the --admin flag.
Options
- --admin
Use administrator privileges to merge a pull request that does not meet requirements
- -A, --author-email <text>
Email text for merge commit author
- --auto
Automatically merge only after necessary requirements are met
- -b, --body <text>
Body text for the merge commit
- -F, --body-file <file>
Read body text from file (use "-" to read from standard input)
- -d, --delete-branch
Delete the local and remote branch after merge
- --disable-auto
Disable auto-merge for this pull request
- --match-head-commit <SHA>
Commit SHA that the pull request head must match to allow merge
- -m, --merge
Merge the commits with the base branch
- -r, --rebase
Rebase the commits onto the base branch
- -s, --squash
Squash the commits into one commit and merge it into the base branch
- -t, --subject <text>
Subject text for the merge commit
Options Inherited from Parent Commands
- -R, --repo <[HOST/]OWNER/REPO>
Select another repository using the [HOST/]OWNER/REPO format
Exit Codes
0: Successful execution
1: Error
2: Command canceled
4: Authentication required
NOTE: Specific commands may have additional exit codes. Refer to the command's help for more information.