Skip to main content

branches

Creates, updates, deletes, gets or lists a branches resource.

Overview

Namebranches
TypeResource
Idaws.codecommit.branches

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
branchestringThe list of branch names.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
list_branchesselectregionGets information about one or more branches in a repository.
get_branchselectregionReturns information about a repository branch, including its name and the last commit ID.
create_branchinsertregion, repositoryName, branchName, commitIdCreates a branch in a repository and points the branch to a commit. Calling the create branch operation does not set a repository's default branch. To do this, call the update default branch operation.
update_default_branchupdateregion, repositoryName, defaultBranchNameSets or changes the default branch name for the specified repository. If you use this operation to change the default branch name to the current default branch name, a success message is returned even though the default branch did not change.
delete_branchdeleteregionDeletes a branch from a repository, unless that branch is the default branch for the repository.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
regionstringAWS region (default: us-east-1)

SELECT examples

Gets information about one or more branches in a repository.

SELECT
branche
FROM aws.codecommit.branches
WHERE region = '{{ region }}' -- required
;

INSERT examples

Creates a branch in a repository and points the branch to a commit. Calling the create branch operation does not set a repository's default branch. To do this, call the update default branch operation.

INSERT INTO aws.codecommit.branches (
repositoryName,
branchName,
commitId,
region
)
SELECT
'{{ repositoryName }}' /* required */,
'{{ branchName }}' /* required */,
'{{ commitId }}' /* required */,
'{{ region }}'
;

UPDATE examples

Sets or changes the default branch name for the specified repository. If you use this operation to change the default branch name to the current default branch name, a success message is returned even though the default branch did not change.

UPDATE aws.codecommit.branches
SET
repositoryName = '{{ repositoryName }}',
defaultBranchName = '{{ defaultBranchName }}'
WHERE
region = '{{ region }}' --required
AND repositoryName = '{{ repositoryName }}' --required
AND defaultBranchName = '{{ defaultBranchName }}' --required;

DELETE examples

Deletes a branch from a repository, unless that branch is the default branch for the repository.

DELETE FROM aws.codecommit.branches
WHERE region = '{{ region }}' --required
;