ListFileCommitHistory
Retrieves a list of commits and changes to a specified file.
Request Syntax
{
   "commitSpecifier": "string",
   "filePath": "string",
   "maxResults": number,
   "nextToken": "string",
   "repositoryName": "string"
}
    
      Request Parameters
For information about the parameters that are common to all actions, see Common Parameters.
The request accepts the following data in JSON format.
- commitSpecifier
 - 
               
The fully quaified reference that identifies the commit that contains the file. For example, you can specify a full commit ID, a tag, a branch name, or a reference such as
refs/heads/main. If none is provided, the head commit is used.Type: String
Required: No
 - filePath
 - 
               
The full path of the file whose history you want to retrieve, including the name of the file.
Type: String
Required: Yes
 - maxResults
 - 
               
A non-zero, non-negative integer used to limit the number of returned results.
Type: Integer
Required: No
 - nextToken
 - 
               
An enumeration token that allows the operation to batch the results.
Type: String
Required: No
 - repositoryName
 - 
               
The name of the repository that contains the file.
Type: String
Length Constraints: Minimum length of 1. Maximum length of 100.
Pattern:
[\w\.-]+Required: Yes
 
Response Syntax
{
   "nextToken": "string",
   "revisionDag": [ 
      { 
         "blobId": "string",
         "commit": { 
            "additionalData": "string",
            "author": { 
               "date": "string",
               "email": "string",
               "name": "string"
            },
            "commitId": "string",
            "committer": { 
               "date": "string",
               "email": "string",
               "name": "string"
            },
            "message": "string",
            "parents": [ "string" ],
            "treeId": "string"
         },
         "path": "string",
         "revisionChildren": [ "string" ]
      }
   ]
}
    
      Response Elements
If the action is successful, the service sends back an HTTP 200 response.
The following data is returned in JSON format by the service.
- nextToken
 - 
               
An enumeration token that can be used to return the next batch of results.
Type: String
 - revisionDag
 - 
               
An array of FileVersion objects that form a directed acyclic graph (DAG) of the changes to the file made by the commits that changed the file.
Type: Array of FileVersion objects
 
Errors
For information about the errors that are common to all actions, see Common Errors.
- CommitDoesNotExistException
 - 
               
The specified commit does not exist or no commit was specified, and the specified repository has no default branch.
HTTP Status Code: 400
 - CommitRequiredException
 - 
               
A commit was not specified.
HTTP Status Code: 400
 - EncryptionIntegrityChecksFailedException
 - 
               
An encryption integrity check failed.
HTTP Status Code: 500
 - EncryptionKeyAccessDeniedException
 - 
               
An encryption key could not be accessed.
HTTP Status Code: 400
 - EncryptionKeyDisabledException
 - 
               
The encryption key is disabled.
HTTP Status Code: 400
 - EncryptionKeyNotFoundException
 - 
               
No encryption key was found.
HTTP Status Code: 400
 - EncryptionKeyUnavailableException
 - 
               
The encryption key is not available.
HTTP Status Code: 400
 - InvalidCommitException
 - 
               
The specified commit is not valid.
HTTP Status Code: 400
 - InvalidContinuationTokenException
 - 
               
The specified continuation token is not valid.
HTTP Status Code: 400
 - InvalidMaxResultsException
 - 
               
The specified number of maximum results is not valid.
HTTP Status Code: 400
 - InvalidRepositoryNameException
 - 
               
A specified repository name is not valid.
Note
This exception occurs only when a specified repository name is not valid. Other exceptions occur when a required repository parameter is missing, or when a specified repository does not exist.
HTTP Status Code: 400
 - RepositoryDoesNotExistException
 - 
               
The specified repository does not exist.
HTTP Status Code: 400
 - RepositoryNameRequiredException
 - 
               
A repository name is required, but was not specified.
HTTP Status Code: 400
 - TipsDivergenceExceededException
 - 
               
The divergence between the tips of the provided commit specifiers is too great to determine whether there might be any merge conflicts. Locally compare the specifiers using
git diffor a diff tool.HTTP Status Code: 400
 
Examples
Example
This example illustrates one usage of ListFileCommitHistory.
Sample Request
POST / HTTP/1.1
Host: codecommit.us-east-1.amazonaws.com
Accept-Encoding: identity
Content-Length: 54
X-Amz-Target: CodeCommit_20150413.ListFileCommitHistory
X-Amz-Date: 20230816T224020Z
User-Agent: aws-cli/1.29.30 Python/3.6.10 Linux/4.9.184-0.1.ac.235.83.329.metal1.x86_64 botocore/1.15.36
Content-Type: application/x-amz-json-1.1
Authorization: AWS4-HMAC-SHA256 Credential=AKIAI44QH8DHBEXAMPLE/20151028/us-east-1/codecommit/aws4_request, SignedHeaders=content-type;host;user-agent;x-amz-date;x-amz-target, Signature=8d9b5998EXAMPLE
{  
  "repositoryName": "MyDemoRepo",
  "filePath": "README.md"
}
          
          
            Sample Response
HTTP/1.1 200 OK
x-amzn-RequestId: 0728aaa8-EXAMPLE
Content-Type: application/x-amz-json-1.1
Content-Length: 300
Date: Wed, 16 Aug 2023 22:40:20 GMT
{
  "revisionDag": [
    { "commit": {…, "commitId": "4f178133EXAMPLE", …}, "blobId": "2eb4af3bEXAMPLE", "filePath": "README.md", "revisionChildren": [] },
    { "commit": {…, "commitId": "317f8570EXAMPLE", …}, "blobId": "bf7fcf28fEXAMPLE", "filePath": "README.md", "revisionChildren": ["4f178133EXAMPLE"] },
  ],
  "nextToken": "exampleToken",
}
          
       
    
      See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following: