az repos pr

Note

This reference is part of the azure-devops extension for the Azure CLI (version 2.30.0 or higher). The extension will automatically install the first time you run an az repos pr command. Learn more about extensions.

Manage pull requests.

Commands

Name Description Type Status
az repos pr checkout

Checkout the PR source branch locally, if no local changes are present.

Extension GA
az repos pr create

Create a pull request.

Extension GA
az repos pr list

List pull requests.

Extension GA
az repos pr policy

Manage pull request policy.

Extension GA
az repos pr policy list

List policies of a pull request.

Extension GA
az repos pr policy queue

Queue an evaluation of a policy for a pull request.

Extension GA
az repos pr reviewer

Manage pull request reviewers.

Extension GA
az repos pr reviewer add

Add one or more reviewers to a pull request.

Extension GA
az repos pr reviewer list

List reviewers of a pull request.

Extension GA
az repos pr reviewer remove

Remove one or more reviewers from a pull request.

Extension GA
az repos pr set-vote

Vote on a pull request.

Extension GA
az repos pr show

Get the details of a pull request.

Extension GA
az repos pr update

Update a pull request.

Extension GA
az repos pr work-item

Manage work items associated with pull requests.

Extension GA
az repos pr work-item add

Link one or more work items to a pull request.

Extension GA
az repos pr work-item list

List linked work items for a pull request.

Extension GA
az repos pr work-item remove

Unlink one or more work items from a pull request.

Extension GA

az repos pr checkout

Checkout the PR source branch locally, if no local changes are present.

az repos pr checkout --id
                     [--remote-name]

Required Parameters

--id

ID of the pull request.

Optional Parameters

--remote-name

Name of git remote against which PR is raised.

Default value: origin
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az repos pr create

Create a pull request.

az repos pr create [--auto-complete {false, true}]
                   [--bypass-policy {false, true}]
                   [--bypass-policy-reason]
                   [--delete-source-branch {false, true}]
                   [--description]
                   [--detect {false, true}]
                   [--draft {false, true}]
                   [--labels]
                   [--merge-commit-message]
                   [--open]
                   [--optional-reviewers]
                   [--org]
                   [--project]
                   [--repository]
                   [--required-reviewers]
                   [--source-branch]
                   [--squash {false, true}]
                   [--target-branch]
                   [--title]
                   [--transition-work-items {false, true}]
                   [--work-items]

Optional Parameters

--auto-complete

Set the pull request to complete automatically when all policies have passed and the source branch can be merged into the target branch.

Accepted values: false, true
Default value: False
--bypass-policy

Bypass required policies (if any) and completes the pull request once it can be merged.

Accepted values: false, true
Default value: False
--bypass-policy-reason

Reason for bypassing the required policies.

--delete-source-branch

Delete the source branch after the pull request has been completed and merged into the target branch.

Accepted values: false, true
Default value: False
--description -d

Description for the new pull request. Can include markdown. Each value sent to this arg will be a new line. For example: --description "First Line" "Second Line".

--detect

Automatically detect organization.

Accepted values: false, true
--draft

Use this flag to create the pull request in draft/work in progress mode.

Accepted values: false, true
--labels

The labels associated with the pull request. Space separated.

--merge-commit-message

Message displayed when commits are merged.

--open

Open the pull request in your web browser.

Default value: False
--optional-reviewers --reviewers

Additional users or groups to include as optional reviewers on the new pull request. Space separated.

--org --organization

Azure DevOps organization URL. You can configure the default organization using az devops configure -d organization=ORG_URL. Required if not configured as default or picked up via git config. Example: https://dev.azure.com/MyOrganizationName/.

--project -p

Name or ID of the project. You can configure the default project using az devops configure -d project=NAME_OR_ID. Required if not configured as default or picked up via git config.

--repository -r

Name or ID of the repository to create the pull request in.

--required-reviewers

Additional users or groups to include as required reviewers on the new pull request. Space separated.

--source-branch -s

Name of the source branch. Example: "dev".

--squash

Squash the commits in the source branch when merging into the target branch.

Accepted values: false, true
Default value: False
--target-branch -t

Name of the target branch. If not specified, defaults to the default branch of the target repository.

--title

Title for the new pull request.

--transition-work-items

Transition any work items linked to the pull request into the next logical state. (e.g. Active -> Resolved).

Accepted values: false, true
Default value: False
--work-items

IDs of the work items to link to the new pull request. Space separated.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az repos pr list

List pull requests.

az repos pr list [--creator]
                 [--detect {false, true}]
                 [--include-links]
                 [--org]
                 [--project]
                 [--repository]
                 [--reviewer]
                 [--skip]
                 [--source-branch]
                 [--status {abandoned, active, all, completed}]
                 [--target-branch]
                 [--top]

Optional Parameters

--creator

Limit results to pull requests created by this user.

--detect

Automatically detect organization.

Accepted values: false, true
--include-links

Include _links for each pull request.

Default value: False
--org --organization

Azure DevOps organization URL. You can configure the default organization using az devops configure -d organization=ORG_URL. Required if not configured as default or picked up via git config. Example: https://dev.azure.com/MyOrganizationName/.

--project -p

Name or ID of the project. You can configure the default project using az devops configure -d project=NAME_OR_ID. Required if not configured as default or picked up via git config.

--repository -r

Name or ID of the repository.

--reviewer

Limit results to pull requests where this user is a reviewer.

--skip

Number of pull requests to skip.

--source-branch -s

Limit results to pull requests that originate from this source branch.

--status

Limit results to pull requests with this status.

Accepted values: abandoned, active, all, completed
--target-branch -t

Limit results to pull requests that target this branch.

--top

Maximum number of pull requests to list.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az repos pr set-vote

Vote on a pull request.

az repos pr set-vote --id
                     --vote {approve, approve-with-suggestions, reject, reset, wait-for-author}
                     [--detect {false, true}]
                     [--org]

Required Parameters

--id

ID of the pull request.

--vote

New vote value for the pull request.

Accepted values: approve, approve-with-suggestions, reject, reset, wait-for-author

Optional Parameters

--detect

Automatically detect organization.

Accepted values: false, true
--org --organization

Azure DevOps organization URL. You can configure the default organization using az devops configure -d organization=ORG_URL. Required if not configured as default or picked up via git config. Example: https://dev.azure.com/MyOrganizationName/.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az repos pr show

Get the details of a pull request.

az repos pr show --id
                 [--detect {false, true}]
                 [--open]
                 [--org]

Required Parameters

--id

ID of the pull request.

Optional Parameters

--detect

Automatically detect organization.

Accepted values: false, true
--open

Open the pull request in your web browser.

Default value: False
--org --organization

Azure DevOps organization URL. You can configure the default organization using az devops configure -d organization=ORG_URL. Required if not configured as default or picked up via git config. Example: https://dev.azure.com/MyOrganizationName/.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az repos pr update

Update a pull request.

az repos pr update --id
                   [--auto-complete {false, true}]
                   [--bypass-policy {false, true}]
                   [--bypass-policy-reason]
                   [--delete-source-branch {false, true}]
                   [--description]
                   [--detect {false, true}]
                   [--draft {false, true}]
                   [--merge-commit-message]
                   [--org]
                   [--squash {false, true}]
                   [--status {abandoned, active, completed}]
                   [--title]
                   [--transition-work-items {false, true}]

Required Parameters

--id

ID of the pull request.

Optional Parameters

--auto-complete

Set the pull request to complete automatically when all policies have passed and the source branch can be merged into the target branch.

Accepted values: false, true
--bypass-policy

Bypass required policies (if any) and completes the pull request once it can be merged.

Accepted values: false, true
--bypass-policy-reason

Reason for bypassing the required policies.

--delete-source-branch

Delete the source branch after the pull request has been completed and merged into the target branch.

Accepted values: false, true
--description -d

New description for the pull request. Can include markdown. Each value sent to this arg will be a new line. For example: --description "First Line" "Second Line".

--detect

Automatically detect organization.

Accepted values: false, true
--draft

Publish the PR or convert to draft mode.

Accepted values: false, true
--merge-commit-message

Message displayed when commits are merged.

--org --organization

Azure DevOps organization URL. You can configure the default organization using az devops configure -d organization=ORG_URL. Required if not configured as default or picked up via git config. Example: https://dev.azure.com/MyOrganizationName/.

--squash

Squash the commits in the source branch when merging into the target branch.

Accepted values: false, true
--status

Set the new state of pull request.

Accepted values: abandoned, active, completed
--title

New title for the pull request.

--transition-work-items

Transition any work items linked to the pull request into the next logical state. (e.g. Active -> Resolved).

Accepted values: false, true
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.