Get-GitHubPullRequest
SYNOPSIS
Get a pull request
SYNTAX
__AllParameterSets
Get-GitHubPullRequest [-Owner] <string> [-Repo] <string> [-PullNumber] <long> [-Accept <string>]
ALIASES
This cmdlet has the following aliases,
- Get-GHPullRequest
DESCRIPTION
The Get-GitHubPullRequest cmdlet invokes the GET method of the /repos/{owner}/{repo}/pulls/{pull_number} endpoint (Get a pull request)
Draft pull requests are available in public repositories with GitHub Free and GitHub Free for organizations, GitHub Pro, and legacy per-repository billing plans, and in public and private repositories with GitHub Team and GitHub Enterprise Cloud. For more information, see GitHub’s products (https://docs.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation.
Lists details of a pull request by providing its number.
When you get, create (https://docs.github.com/rest/pulls/pulls/#create-a-pull-request), or edit (https://docs.github.com/rest/pulls/pulls#update-a-pull-request) a pull request, GitHub creates a merge commit to test whether the pull request can be automatically merged into the base branch. This test commit is not added to the base branch or the head branch. You can review the status of the test commit using the ‘mergeable’ key. For more information, see “Checking mergeability of pull requests (https://docs.github.com/rest/guides/getting-started-with-the-git-database-api#checking-mergeability-of-pull-requests)”.
The value of the ‘mergeable’ attribute can be ‘true’, ‘false’, or ‘null’. If the value is ‘null’, then GitHub has started a background job to compute the mergeability. After giving the job time to complete, resubmit the request. When the job finishes, you will see a non-‘null’ value for the ‘mergeable’ attribute in the response. If ‘mergeable’ is ‘true’, then ‘merge_commit_sha’ will be the SHA of the test merge commit.
The value of the ‘merge_commit_sha’ attribute changes depending on the state of the pull request. Before merging a pull request, the ‘merge_commit_sha’ attribute holds the SHA of the test merge commit. After merging a pull request, the ‘merge_commit_sha’ attribute changes depending on how you merged the pull request:
- If merged as a merge commit (https://docs.github.com/articles/about-merge-methods-on-github/), ‘merge_commit_sha’ represents the SHA of the merge commit.
- If merged via a squash (https://docs.github.com/articles/about-merge-methods-on-github/#squashing-your-merge-commits), ‘merge_commit_sha’ represents the SHA of the squashed commit on the base branch.
- If rebased (https://docs.github.com/articles/about-merge-methods-on-github/#rebasing-and-merging-your-commits), ‘merge_commit_sha’ represents the commit that the base branch was updated to.
Pass the appropriate media type (https://docs.github.com/rest/using-the-rest-api/getting-started-with-the-rest-api#media-types) to fetch diff and patch formats.
This endpoint supports the following custom media types. For more information, see “Media types (https://docs.github.com/rest/using-the-rest-api/getting-started-with-the-rest-api#media-types).”
- ‘application/vnd.github.raw+json’: Returns the raw markdown body. Response will include ‘body’. This is the default if you do not pass any specific media type.
- ‘application/vnd.github.text+json’: Returns a text only representation of the markdown body. Response will include ‘body_text’.
- ‘application/vnd.github.html+json’: Returns HTML rendered from the body’s markdown. Response will include ‘body_html’.
- ‘application/vnd.github.full+json’: Returns raw, text, and HTML representations. Response will include ‘body’, ‘body_text’, and ‘body_html’.
- ‘application/vnd.github.diff’: For more information, see “git-diff (https://git-scm.com/docs/git-diff)” in the Git documentation. If a diff is corrupt, contact us through the GitHub Support portal (https://support.github.com/). Include the repository name and pull request ID in your message.
Endpoint: GET /repos/{owner}/{repo}/pulls/{pull_number} API version: 2026-03-10
EXAMPLES
EXAMPLE 1
Get-GitHubPullRequest -Owner 'octocat' -Repo 'Hello-World' -PullNumber 1
Invokes GET /repos/{owner}/{repo}/pulls/{pull_number}
PARAMETERS
-Accept
The Accept header (media type) of the request Default value: application/vnd.github+json
Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-Owner
The account owner of the repository. The name is not case sensitive.
Path parameter [ owner ]
Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: 0
IsRequired: true
ValueFromPipeline: false
ValueFromPipelineByPropertyName: true
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-PullNumber
The number that identifies the pull request.
Path parameter [ pull_number ]
Type: System.Int64
DefaultValue: 0
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: 2
IsRequired: true
ValueFromPipeline: false
ValueFromPipelineByPropertyName: true
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-Repo
The name of the repository without the ‘.git’ extension. The name is not case sensitive.
Path parameter [ repo ]
Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: 1
IsRequired: true
ValueFromPipeline: false
ValueFromPipelineByPropertyName: true
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
INPUTS
Objects with properties named like the path parameters can be piped to this function
{{ Fill in the Description }}
System.String
{{ Fill in the Description }}
System.Int64
{{ Fill in the Description }}
OUTPUTS
The response of the GitHub API (objects
{{ Fill in the Description }}
NOTES
OperationId: pulls/get Category: pulls / pulls