LinuxCommandLibrary

gh-pr-merge

Merge GitHub pull requests.

TLDR

Merge the pull request associated with the current branch interactively

$ gh pr merge
copy


Merge the specified pull request, interactively
$ gh pr merge [pr_number]
copy


Merge the pull request, removing the branch on both the local and the remote
$ gh pr merge --delete-branch
copy


Merge the current pull request with the specified merge strategy
$ gh pr merge --[merge|squash|rebase]
copy


Merge the current pull request with the specified merge strategy and commit message
$ gh pr merge --[merge|squash|rebase] --subject [commit_message]
copy


Squash the current pull request into one commit with the message body and merge
$ gh pr merge --squash --body="[commit_message_body]"
copy


Display help
$ gh pr merge --help
copy

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.

OPTIONS

--admin

Use administrator privileges to merge a pull request that does not meet requirements

--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

-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

SEE ALSO

gh-pr(1)

Copied to clipboard