Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Searching Commits in Bitbucket

With its user-friendly interface and functionality, Bitbucket has significantly enhanced the development workflow of teams and organizations that use Git. However, sometimes it can be hard to deal with commits. Have you ever squandered time scrolling the mouse wheel looking for old commits? Fortunately, there are certain things you can do to make things easy.

Of course, third-party solutions like Sourcetree or Awesome Graphs for Bitbucket can help you search for commits effectively. You can also use Bitbucket REST API, Awesome Graphs REST API, and the Export to CSV feature.

But first things first.

Sourcetree

Sourcetree is a free client for Windows and Mac that helps you to work with Git and Mercurial repositories. It allows you to look for commits made by a specific author, as well as commit messages and files.

Sourcetree search opportunities.png

To look at all commits for all repositories, you will need to go to each one manually. You have to install it for each device and remember that it doesn't support Linux.

Search for commits via REST API

Use this request to obtain all commits in the repository.

https://example.com/rest/api/1.0/projects/exampleprojectkey/repos/example-repository-slug/commits

You can add more parameters to get more detailed information.

https://example.com/rest/api/1.0/projects/exampleprojectkey/repos/example-repository-slug/commits?merges=exclude&since=ea3eea9dcbd&until=f4240bf022a

As a result, you receive a JSON response with the list of the commits and their IDs, author's names and email addresses, commit messages, and parents. 

{
    "values": [
        {
            "id": "f4211bf025769815241aaz4c03645444b58ac553",
            "displayId": "f4251bf022a",
            "author": {
                "name": "Bob McBobberson",
                "emailAddress": "bob@example.com"
            },
            "authorTimestamp": 1557113671000,
            "committer": {
                "name": "Na Mely",
                
"emailAddress": "namely@example.com"
            },
            "committerTimestamp": 1557113671000,
            "message": "Add internal section link to README.md (#71)",
            "parents": [
                
{
                    
"id": "ea3eea9dcbd46887d846696261f5bbb2f74fecd",
                    
"displayId": "ea3eea333cbd"
                }
            ]
        },

You can also use the Awesome Graphs REST API that provides global, user, project, and repository data. The solution allows you to retrieve data faster while decreasing the load on the instance compared to Bitbucket REST API. 

Use this request to get a list of commits from the specified repository.

https://example.com/rest/awesome-graphs-api/latest/projects/exampleprojectkey/repos/example-repository-slug/commits

The response will look as follows:

{
  "values": [
    {
      
"user": {
        
"emailAddress": "abced@example.com",
        "displayName": "Administrator",
        
"name": "admin"
      },
      "author": {
        "displayName": "admin",
        "emailAddress": "abced@example.com"
      },
      "authorTimestamp": "2020-03-05T22:58:18Z",
      "linesOfCode": {
        "added": 1,
        
"deleted": 0
      
},
      
"parents": [],
      "repository": {
        
"slug": "Commit Hook",
        "name": "commit-hook",
        
"project": {
          "key": "TESTCONTAINERS",
          "name": "Testcontainers",
          "type": "NORMAL"
        }
      },
      "id": "9f2e24a147bb8f5a511110b692703cc5784df8b5"
    },
  ],
}

Learn more about the available REST API resources.

Awesome Graphs for Bitbucket

With the help of Awesome Graphs for Bitbucket, tech teams can improve and optimize their processes, getting insights into the code review process. Among other things, they can easily search for commits since it indexes commit content, making it easier to search by author, time, or repository. The app provides you with a wide set of graphs based on your requirements.

You can use the Contributions graph to look for all the commits made by a person in all projects and repositories, filtering them by required time period, project, or repository.

Contributions graph.png

Here is the activity stream with all commits.

activity-stream.png

Take advantage of the Activity graph to locate all commits to a specific repository.

Activity.png

The Top Committers Report is a lifesaver when you want to search for the old commits. This report locates the most active contributors. However, you can set the required period and select the authors of the commits you are looking for.

Top Committers Report.png

Export commit data to CSV

You can also export commit data to CSV and get a list with detailed information.

commits-export-1.png

To directly export raw commit data to CSV from Bitbucket, go to the People tab and export commit data choosing CSV.

people-csv.png

You can also use Awesome Graphs REST API.

Options to choose from

We've highlighted different solutions that can help you manage commits:

  • You can take advantage of Sourcetree when you work with a limited number of repositories.
  • Use the Awesome Graphs for Bitbucket app when you need a more comprehensive approach to search and analytics in Bitbucket.
  • Get the list of commits in the repository with the help of Bitbucket REST API.

Tell us about your way of searching commits. Feel free to ask us any questions you have.

0 comments

Comment

Log in or Sign up to comment
TAGS
AUG Leaders

Atlassian Community Events