Select your cookie preferences

We use cookies and similar tools to enhance your experience, provide our services, deliver relevant advertising, and make improvements. Approved third parties also use these tools to help us deliver advertising and provide certain site features.

delete_branch

delete_branch(**kwargs)

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

See also: AWS API Documentation

Request Syntax

response = client.delete_branch(
    repositoryName='string',
    branchName='string'
)
Parameters
  • repositoryName (string) --

    [REQUIRED]

    The name of the repository that contains the branch to be deleted.

  • branchName (string) --

    [REQUIRED]

    The name of the branch to delete.

Return type

dict

Returns

Response Syntax

{
    'deletedBranch': {
        'branchName': 'string',
        'commitId': 'string'
    }
}

Response Structure

  • (dict) --

    Represents the output of a delete branch operation.

    • deletedBranch (dict) --

      Information about the branch deleted by the operation, including the branch name and the commit ID that was the tip of the branch.

      • branchName (string) --

        The name of the branch.

      • commitId (string) --

        The ID of the last commit made to the branch.

Exceptions

  • CodeCommit.Client.exceptions.RepositoryNameRequiredException
  • CodeCommit.Client.exceptions.RepositoryDoesNotExistException
  • CodeCommit.Client.exceptions.InvalidRepositoryNameException
  • CodeCommit.Client.exceptions.BranchNameRequiredException
  • CodeCommit.Client.exceptions.InvalidBranchNameException
  • CodeCommit.Client.exceptions.DefaultBranchCannotBeDeletedException
  • CodeCommit.Client.exceptions.EncryptionIntegrityChecksFailedException
  • CodeCommit.Client.exceptions.EncryptionKeyAccessDeniedException
  • CodeCommit.Client.exceptions.EncryptionKeyDisabledException
  • CodeCommit.Client.exceptions.EncryptionKeyNotFoundException
  • CodeCommit.Client.exceptions.EncryptionKeyUnavailableException