:doc:`CodeCommit <../../codecommit>` / Client / get_branch

**********
get_branch
**********



.. py:method:: CodeCommit.Client.get_branch(**kwargs)

  

  Returns information about a repository branch, including its name and the last commit ID.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/GetBranch>`_  


  **Request Syntax**
  ::

    response = client.get_branch(
        repositoryName='string',
        branchName='string'
    )
    
  :type repositoryName: string
  :param repositoryName: 

    The name of the repository that contains the branch for which you want to retrieve information.

    

  
  :type branchName: string
  :param branchName: 

    The name of the branch for which you want to retrieve information.

    

  
  
  :rtype: dict
  :returns: 
    
    **Response Syntax**

    
    ::

      {
          'branch': {
              'branchName': 'string',
              'commitId': 'string'
          }
      }
      
    **Response Structure**

    

    - *(dict) --* 

      Represents the output of a get branch operation.

      
      

      - **branch** *(dict) --* 

        The name of the branch.

        
        

        - **branchName** *(string) --* 

          The name of the branch.

          
        

        - **commitId** *(string) --* 

          The ID of the last commit made to the branch.

          
    
  
  **Exceptions**
  
  *   :py:class:`CodeCommit.Client.exceptions.RepositoryNameRequiredException`

  
  *   :py:class:`CodeCommit.Client.exceptions.RepositoryDoesNotExistException`

  
  *   :py:class:`CodeCommit.Client.exceptions.InvalidRepositoryNameException`

  
  *   :py:class:`CodeCommit.Client.exceptions.BranchNameRequiredException`

  
  *   :py:class:`CodeCommit.Client.exceptions.InvalidBranchNameException`

  
  *   :py:class:`CodeCommit.Client.exceptions.BranchDoesNotExistException`

  
  *   :py:class:`CodeCommit.Client.exceptions.EncryptionIntegrityChecksFailedException`

  
  *   :py:class:`CodeCommit.Client.exceptions.EncryptionKeyAccessDeniedException`

  
  *   :py:class:`CodeCommit.Client.exceptions.EncryptionKeyDisabledException`

  
  *   :py:class:`CodeCommit.Client.exceptions.EncryptionKeyNotFoundException`

  
  *   :py:class:`CodeCommit.Client.exceptions.EncryptionKeyUnavailableException`

  