v2

Swagger 2.02026-08-01331211921.0 KB
Source
Repositories

List commits that modified a file

Returns a paginated list of commits that modified the specified file.

Commits are returned in reverse chronological order. This is roughly equivalent to the following commands:

$ git log --follow --date-order <sha> <path>

By default, Bitbucket will follow renames and the path name in the returned entries reflects that. This can be turned off using the ?renames=false query parameter.

Results are returned in descending chronological order by default, and like most endpoints you can filter and sort the response to only provide exactly the data you want.

The example response returns commits made before 2011-05-18 against a file named README.rst. The results are filtered to only return the path and date. This request can be made using:

$ curl 'https://api.bitbucket.org/2.0/repositories/evzijst/dogslow/filehistory/master/README.rst'\
  '?fields=values.next,values.path,values.commit.date&q=commit.date<=2011-05-18'

In the response you can see that the file was renamed to README.rst by the commit made on 2011-05-16, and was previously named README.txt.

get/repositories/{workspace}/{repo_slug}/filehistory/{commit}/{path}

Query parameters

renamesstring

When true, Bitbucket will follow the history of the file across renames (this is the default behavior). This can be turned off by specifying false.

qstring

Query string to narrow down the response as per filtering and sorting.

sortstring

Name of a response property sort the result by as per filtering and sorting.

Response

A paginated list of commits that modified the specified file

sizeinteger

Total number of objects in the response. This is an optional element that is not provided in all responses, as it can be expensive to compute.

pageinteger

Page number of the current results. This is an optional element that is not provided in all responses.

pageleninteger

Current number of objects on the existing page. The default value is 10 with 100 being the maximum allowed value. Individual APIs may enforce different values.

nextstring uri

Link to the next page if it exists. The last page of a collection does not have this value. Use this link to navigate the result set and refrain from constructing your own URLs.

previousstring uri

Link to previous page if it exists. A collections first page does not have this value. This is an optional element that is not provided in all responses. Some result sets strictly support forward navigation and never provide previous links. Clients must anticipate that backwards navigation is not always available. Use this link to navigate the result set and refrain from constructing your own URLs.