View a markdown version of this page

Use GetBranch with a CLI - AWS SDK Code Examples

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

Use GetBranch with a CLI

The following code examples show how to use GetBranch.

CLI
AWS CLI

To get information about a branch

The following get-branch example gets information about a branch in an AWS CodeCommit repository.

aws codecommit get-branch \ --repository-name MyDemoRepo \ --branch-name MyNewBranch

Output:

{ "branch": { "commitId": "317f8570EXAMPLE", "branchName": "MyNewBranch" } }

For more information, see View branch details in AWS CodeCommit in the AWS CodeCommit User Guide.

  • For API details, see GetBranch in AWS CLI Command Reference.

PowerShell
Tools for PowerShell V4

Example 1: This example gets information about the specified branch for the specified repository.

Get-CCBranch -RepositoryName MyDemoRepo -BranchName MyNewBranch

Output:

BranchName CommitId ---------- -------- MyNewBranch 7763222d...561fc9c9
  • For API details, see GetBranch in AWS Tools for PowerShell Cmdlet Reference (V4).

Tools for PowerShell V5

Example 1: This example gets information about the specified branch for the specified repository.

Get-CCBranch -RepositoryName MyDemoRepo -BranchName MyNewBranch

Output:

BranchName CommitId ---------- -------- MyNewBranch 7763222d...561fc9c9
  • For API details, see GetBranch in AWS Tools for PowerShell Cmdlet Reference (V5).