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
This example gets information about a branch in an AWS CodeCommit repository.
Command:
aws codecommit get-branch --repository-nameMyDemoRepo--branch-nameMyNewBranchOutput:
{ "BranchInfo": { "commitID": "317f8570EXAMPLE", "branchName": "MyNewBranch" } }-
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).
-