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

*************
create_commit
*************



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

  

  Creates a commit for a repository on the tip of a specified branch.

  

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


  **Request Syntax**
  ::

    response = client.create_commit(
        repositoryName='string',
        branchName='string',
        parentCommitId='string',
        authorName='string',
        email='string',
        commitMessage='string',
        keepEmptyFolders=True|False,
        putFiles=[
            {
                'filePath': 'string',
                'fileMode': 'EXECUTABLE'|'NORMAL'|'SYMLINK',
                'fileContent': b'bytes',
                'sourceFile': {
                    'filePath': 'string',
                    'isMove': True|False
                }
            },
        ],
        deleteFiles=[
            {
                'filePath': 'string'
            },
        ],
        setFileModes=[
            {
                'filePath': 'string',
                'fileMode': 'EXECUTABLE'|'NORMAL'|'SYMLINK'
            },
        ]
    )
    
  :type repositoryName: string
  :param repositoryName: **[REQUIRED]** 

    The name of the repository where you create the commit.

    

  
  :type branchName: string
  :param branchName: **[REQUIRED]** 

    The name of the branch where you create the commit.

    

  
  :type parentCommitId: string
  :param parentCommitId: 

    The ID of the commit that is the parent of the commit you create. Not required if this is an empty repository.

    

  
  :type authorName: string
  :param authorName: 

    The name of the author who created the commit. This information is used as both the author and committer for the commit.

    

  
  :type email: string
  :param email: 

    The email address of the person who created the commit.

    

  
  :type commitMessage: string
  :param commitMessage: 

    The commit message you want to include in the commit. Commit messages are limited to 256 KB. If no message is specified, a default message is used.

    

  
  :type keepEmptyFolders: boolean
  :param keepEmptyFolders: 

    If the commit contains deletions, whether to keep a folder or folder structure if the changes leave the folders empty. If true, a ..gitkeep file is created for empty folders. The default is false.

    

  
  :type putFiles: list
  :param putFiles: 

    The files to add or update in this commit.

    

  
    - *(dict) --* 

      Information about a file added or updated as part of a commit.

      

    
      - **filePath** *(string) --* **[REQUIRED]** 

        The full path to the file in the repository, including the name of the file.

        

      
      - **fileMode** *(string) --* 

        The extrapolated file mode permissions for the file. Valid values include EXECUTABLE and NORMAL.

        

      
      - **fileContent** *(bytes) --* 

        The content of the file, if a source file is not specified.

        

      
      - **sourceFile** *(dict) --* 

        The name and full path of the file that contains the changes you want to make as part of the commit, if you are not providing the file content directly.

        

      
        - **filePath** *(string) --* **[REQUIRED]** 

          The full path to the file, including the name of the file.

          

        
        - **isMove** *(boolean) --* 

          Whether to remove the source file from the parent commit.

          

        
      
    

  :type deleteFiles: list
  :param deleteFiles: 

    The files to delete in this commit. These files still exist in earlier commits.

    

  
    - *(dict) --* 

      A file that is deleted as part of a commit.

      

    
      - **filePath** *(string) --* **[REQUIRED]** 

        The full path of the file to be deleted, including the name of the file.

        

      
    

  :type setFileModes: list
  :param setFileModes: 

    The file modes to update for files in this commit.

    

  
    - *(dict) --* 

      Information about the file mode changes.

      

    
      - **filePath** *(string) --* **[REQUIRED]** 

        The full path to the file, including the name of the file.

        

      
      - **fileMode** *(string) --* **[REQUIRED]** 

        The file mode for the file.

        

      
    

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

    
    ::

      {
          'commitId': 'string',
          'treeId': 'string',
          'filesAdded': [
              {
                  'absolutePath': 'string',
                  'blobId': 'string',
                  'fileMode': 'EXECUTABLE'|'NORMAL'|'SYMLINK'
              },
          ],
          'filesUpdated': [
              {
                  'absolutePath': 'string',
                  'blobId': 'string',
                  'fileMode': 'EXECUTABLE'|'NORMAL'|'SYMLINK'
              },
          ],
          'filesDeleted': [
              {
                  'absolutePath': 'string',
                  'blobId': 'string',
                  'fileMode': 'EXECUTABLE'|'NORMAL'|'SYMLINK'
              },
          ]
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

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

        The full commit ID of the commit that contains your committed file changes.

        
      

      - **treeId** *(string) --* 

        The full SHA-1 pointer of the tree information for the commit that contains the commited file changes.

        
      

      - **filesAdded** *(list) --* 

        The files added as part of the committed file changes.

        
        

        - *(dict) --* 

          A file to be added, updated, or deleted as part of a commit.

          
          

          - **absolutePath** *(string) --* 

            The full path to the file to be added or updated, including the name of the file.

            
          

          - **blobId** *(string) --* 

            The blob ID that contains the file information.

            
          

          - **fileMode** *(string) --* 

            The extrapolated file mode permissions for the file. Valid values include EXECUTABLE and NORMAL.

            
      
    
      

      - **filesUpdated** *(list) --* 

        The files updated as part of the commited file changes.

        
        

        - *(dict) --* 

          A file to be added, updated, or deleted as part of a commit.

          
          

          - **absolutePath** *(string) --* 

            The full path to the file to be added or updated, including the name of the file.

            
          

          - **blobId** *(string) --* 

            The blob ID that contains the file information.

            
          

          - **fileMode** *(string) --* 

            The extrapolated file mode permissions for the file. Valid values include EXECUTABLE and NORMAL.

            
      
    
      

      - **filesDeleted** *(list) --* 

        The files deleted as part of the committed file changes.

        
        

        - *(dict) --* 

          A file to be added, updated, or deleted as part of a commit.

          
          

          - **absolutePath** *(string) --* 

            The full path to the file to be added or updated, including the name of the file.

            
          

          - **blobId** *(string) --* 

            The blob ID that contains the file information.

            
          

          - **fileMode** *(string) --* 

            The extrapolated file mode permissions for the file. Valid values include EXECUTABLE and NORMAL.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  
  *   :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`

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

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

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

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

  