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

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.

Servers

Path parameters

Name Type Required Description
commit String Yes

The commit's SHA1.

repo_slug String Yes

This can either be the repository slug or the UUID of the repository, surrounded by curly-braces, for example: {repository UUID}.

workspace String Yes

This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example: {workspace UUID}.

path String Yes

Path to the file.

Query parameters

Name Type Required Description
renames String No

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.

q String No

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

sort String No

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

How to start integrating

  1. Add HTTP Task to your workflow definition.
  2. Search for the API you want to integrate with and click on the name.
    • This loads the API reference documentation and prepares the Http request settings.
  3. Click Test request to test run your request to the API and see the API's response.