1. hub-pr(1)
  2. hub manual
  3. hub-pr(1)

Manage GitHub Pull Requests for the current repository.

Synopsis

hub pr list [-s STATE] [-h HEAD] [-b BASE] [-o SORT_KEY [-^]] [-f FORMAT] [-L LIMIT]
hub pr checkout PR-NUMBER [BRANCH]
hub pr show [-uc] [-f FORMAT] [-h HEAD]
hub pr show [-uc] [-f FORMAT] PR-NUMBER
hub pr merge [-d] [--squash | --rebase] PR-NUMBER [-m MESSAGE | -F FILE] [--head-sha COMMIT-SHA]

Commands

list

List pull requests in the current repository.

checkout

Check out the head of a pull request in a new branch.

To update the pull request with new commits, use git push.

show

Open a pull request page in a web browser. When no PR-NUMBER is specified, HEAD is used to look up open pull requests and defaults to the current branch name. With --format, print information about the pull request instead of opening it.

merge

Merge a pull request in the current repository remotely. Select an alternate merge method with --squash or --rebase. Change the commit subject and body with --message or --file.

Options

-s, --state STATE

Filter pull requests by STATE. Supported values are: "open" (default), "closed", "merged", or "all".

-h, --head BRANCH

Show pull requests started from the specified head BRANCH. The "OWNER:BRANCH" format must be used for pull requests from forks.

-b, --base BRANCH

Show pull requests based off the specified BRANCH.

-f, --format FORMAT

Pretty print the list of pull requests using format FORMAT (default: "%pC%>(8)%i%Creset %t% l%n"). See the "PRETTY FORMATS" section of git-log(1) for some additional details on how placeholders are used in format. The available placeholders are:

%I: pull request number

%i: pull request number prefixed with "#"

%U: the URL of this pull request

%S: state ("open" or "closed")

%pS: pull request state ("open", "draft", "merged", or "closed")

%sC: set color to red or green, depending on state

%pC: set color according to pull request state

%t: title

%l: colored labels

%L: raw, comma-separated labels

%b: body

%B: base branch

%sB: base commit SHA

%H: head branch

%sH: head commit SHA

%sm: merge commit SHA

%au: login name of author

%as: comma-separated list of assignees

%rs: comma-separated list of requested reviewers

%Mn: milestone number

%Mt: milestone title

%cD: created date-only (no time of day)

%cr: created date, relative

%ct: created date, UNIX timestamp

%cI: created date, ISO 8601 format

%uD: updated date-only (no time of day)

%ur: updated date, relative

%ut: updated date, UNIX timestamp

%uI: updated date, ISO 8601 format

%mD: merged date-only (no time of day)

%mr: merged date, relative

%mt: merged date, UNIX timestamp

%mI: merged date, ISO 8601 format

%n: newline

%%: a literal %

--color[=WHEN]

Enable colored output even if stdout is not a terminal. WHEN can be one of "always" (default for --color), "never", or "auto" (default).

-o, --sort KEY

Sort displayed pull requests by "created" (default), "updated", "popularity", or "long-running".

-^, --sort-ascending

Sort by ascending dates instead of descending.

-L, --limit LIMIT

Display only the first LIMIT pull requests.

-u, --url

Print the pull request URL instead of opening it.

-c, --copy

Put the pull request URL to clipboard instead of opening it.

-m, --message MESSAGE

The text up to the first blank line in MESSAGE is treated as the commit subject for the merge commit, and the rest is used as commit body.

When multiple --message are passed, their values are concatenated with a blank line in-between.

-F, --file FILE

Read the subject and body for the merge commit from FILE. Pass "-" to read from standard input instead. See --message for the formatting rules.

--head-sha COMMIT-SHA

Ensure that the head of the pull request matches the commit SHA when merging.

--squash

Squash commits instead of creating a merge commit when merging a pull request.

--rebase

Rebase commits on top of the base branch when merging a pull request.

-d, --delete-branch

Delete the head branch after successfully merging a pull request.

See also

hub-issue(1), hub-pull-request(1), hub(1)