az repos pr

Manage pull requests.

Commands

az repos pr checkout Checkout the PR source branch locally, if no local changes are present.
az repos pr create Create a pull request.
az repos pr list List pull requests.
az repos pr policy Manage pull request policy.
az repos pr policy list List policies of a pull request.
az repos pr policy queue Queue an evaluation of a policy for a pull request.
az repos pr reviewer Manage pull request reviewers.
az repos pr reviewer add Add one or more reviewers to a pull request.
az repos pr reviewer list List reviewers of a pull request.
az repos pr reviewer remove Remove one or more reviewers from a pull request.
az repos pr set-vote Vote on a pull request.
az repos pr show Get the details of a pull request.
az repos pr update Update a pull request.
az repos pr work-item Manage work items associated with pull requests.
az repos pr work-item add Link one or more work items to a pull request.
az repos pr work-item list List linked work items for a pull request.
az repos pr work-item remove Unlink one or more work items from a pull request.

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

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}]
[--merge-commit-message]
[--open]
[--org]
[--project]
[--repository]
[--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
--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

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
--merge-commit-message

Message displayed when commits are merged.

--open

Open the pull request in your web browser.

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

--reviewers

Additional users or groups to include as 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
--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
--work-items

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

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.

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

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

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.

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

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