Use ListBranches with a CLI - AWS SDK Code Examples

There are more AWS SDK examples available in the AWS Doc SDK Examples GitHub repo.

Use ListBranches with a CLI

The following code examples show how to use ListBranches.

CLI
AWS CLI

To view a list of branch names

This example lists all branch names in an AWS CodeCommit repository.

aws codecommit list-branches \ --repository-name MyDemoRepo

Output:

{ "branches": [ "MyNewBranch", "main" ] }
  • For API details, see ListBranches in AWS CLI Command Reference.

PowerShell
Tools for PowerShell

Example 1: This example gets a list of branch names for the specified repository.

Get-CCBranchList -RepositoryName MyDemoRepo

Output:

master MyNewBranch
  • For API details, see ListBranches in AWS Tools for PowerShell Cmdlet Reference.