LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

az-repos

Manage Azure DevOps Git repositories and pull requests

TLDR

List all repositories in a project
$ az repos list --project [MyProject]
copy
Show details of a repository
$ az repos show --repository [MyRepo] --project [MyProject]
copy
Create a new repository
$ az repos create --name [MyRepo] --project [MyProject]
copy
Get the clone URL of a repository
$ az repos show --repository [MyRepo] --project [MyProject] --query remoteUrl
copy
Delete a repository
$ az repos delete --id [repo_id] --project [MyProject]
copy
List pull requests
$ az repos pr list --project [MyProject]
copy
Create a pull request
$ az repos pr create --repository [MyRepo] --source-branch [feature] --target-branch [main] --title [My PR]
copy
Show pull request details
$ az repos pr show --id [pr_id]
copy
Complete (merge) a pull request
$ az repos pr update --id [pr_id] --status completed
copy

SYNOPSIS

az repos subcommand [options]

DESCRIPTION

az repos manages Azure Repos, the Git repository hosting service in Azure DevOps. It provides commands for managing repositories, pull requests, references, branch policies, and repository imports.This command group is part of the azure-devops extension and works with Azure DevOps Services.

PARAMETERS

--org, --organization

Azure DevOps organization URL, for example `https://dev.azure.com/MyOrg/`. Required unless set as a default with az devops configure -d organization=URL or detected from local git config.
--project, -p
Name or ID of the project. Required unless set as a default with az devops configure -d project=NAME.
--repository, -r
Name or ID of the repository.
--detect
Automatically detect the organization from local git context. Accepts true or false.

SUBCOMMANDS

list

List repositories.
show
Show repository details.
create
Create a repository.
delete
Delete a repository.
update
Update a repository.
pr list
List pull requests.
pr create
Create a pull request.
pr show
Get the details of a pull request.
pr update
Update a pull request (set title, description, status; complete by setting --status completed).
pr checkout
Check out the PR source branch locally.
pr set-vote
Vote on a pull request (approve, reject, and so on).
pr reviewer
Add, list, or remove pull request reviewers.
pr work-item
Link or unlink work items to a pull request.
policy
Manage branch policies (approver-count, build, comment-required, and more).
ref
Manage Git references (create, delete, list, lock, unlock).
import create
Create a Git import request.

INSTALL

sudo dnf install azure-cli
copy
sudo pacman -S azure-cli
copy
sudo zypper install azure-cli
copy
brew install azure-cli
copy
nix profile install nixpkgs#azure-cli
copy

CAVEATS

Part of the azure-devops extension (Azure CLI 2.30.0 or higher). The extension installs automatically the first time an az repos command runs, or install it manually with az extension add --name azure-devops. Set persistent defaults with az devops configure -d organization=URL project=NAME to avoid repeating --org and --project.

SEE ALSO

RESOURCES

Copied to clipboard
Kai