There are more AWS SDK examples available in the AWS Doc SDK Examples
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-branchexample gets information about a branch in an AWS CodeCommit repository.aws codecommit get-branch \ --repository-nameMyDemoRepo\ --branch-nameMyNewBranchOutput:
{ "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 MyNewBranchOutput:
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 MyNewBranchOutput:
BranchName CommitId ---------- -------- MyNewBranch 7763222d...561fc9c9-
For API details, see GetBranch in AWS Tools for PowerShell Cmdlet Reference (V5).
-