ListFileCommitHistory - AWS CodeCommit


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.


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


The full path of the file whose history you want to retrieve, including the name of the file.

Type: String

Required: Yes


A non-zero, non-negative integer used to limit the number of returned results.

Type: Integer

Required: No


An enumeration token that allows the operation to batch the results.

Type: String

Required: No


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.


An enumeration token that can be used to return the next batch of results.

Type: String


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


For information about the errors that are common to all actions, see Common Errors.


The specified commit does not exist or no commit was specified, and the specified repository has no default branch.

HTTP Status Code: 400


A commit was not specified.

HTTP Status Code: 400


An encryption integrity check failed.

HTTP Status Code: 500


An encryption key could not be accessed.

HTTP Status Code: 400


The encryption key is disabled.

HTTP Status Code: 400


No encryption key was found.

HTTP Status Code: 400


The encryption key is not available.

HTTP Status Code: 400


The specified commit is not valid.

HTTP Status Code: 400


The specified continuation token is not valid.

HTTP Status Code: 400


The specified number of maximum results is not valid.

HTTP Status Code: 400


A specified repository name is not valid.


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


The specified repository does not exist.

HTTP Status Code: 400


A repository name is required, but was not specified.

HTTP Status Code: 400


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 diff or a diff tool.

HTTP Status Code: 400



This example illustrates one usage of ListFileCommitHistory.

Sample Request

POST / HTTP/1.1 Host: 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/ 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": "" }

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": "", "revisionChildren": [] }, { "commit": {…, "commitId": "317f8570EXAMPLE", …}, "blobId": "bf7fcf28fEXAMPLE", "filePath": "", "revisionChildren": ["4f178133EXAMPLE"] }, ], "nextToken": "exampleToken", }

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: