How to Search for Commits in Bitbucket Server and Data Center
Bitbucket has greatly improved the development workflow of teams and companies that use Git with its friendly interface and features. However, sometimes it lacks opportunities for convenient work with commits. Have you ever wasted time scrolling the mouse wheel trying to find some of the old commits? Luckily, there are some ways to make your life easier and search for commits in Bitbucket. In this article, you will learn how to find:
- projects and repositories in your Bitbucket that a certain user contributed to (filter by author)
- commits that were made long ago to a repository with high activity (filter by time)
- the commits of a user made to a repository or project (filter by author and project/repo)
- all the commits made to a project (filter by project).
Sourcetree search opportunities
Sourcetree is an Atlassian desktop client for working with Git and Mercurial repositories. It provides an opportunity to search for commits by an author, a commit message, and a file.
Use Awesome Graphs to search commits in Bitbucket
Awesome Graphs for Bitbucket helps engineering leaders and software teams improve their processes and deliver products faster by transforming invisible development activities into easy-to-understand insights and reports. Convenient search for commits isn’t its main purpose, but a nice bonus.
This app indexes information about commits, which makes searching by author, time, or repository faster and does not affect even huge Bitbucket instances (70,000+ repositories).
The Contributions graph shows the activity of each developer during a year as a calendar. So it’s an easy way to find all the commits made by a person to all projects and repositories. Here you can also filter the commits of a particular user by time period (up to a year) and by project or repository.
Below the calendar, there is a list of all commits made during the selected time span. By default, it’s a year, but it’s possible to choose any period to display.
In order to find the commits made to a certain repository regardless of their author, use the Activity graph. It shows all commits for the last year or a shorter time span in the Activity section below the charts.
And if you need to find commits made long ago, the Top Committers Report can be a good solution. In general, its use-case is to find the most active contributors of the project or repository, but you can configure the Period of time and choose Authors of the commits you’re searching for.
As a result, it shows the list of all commits for the selected time span in the Activity section below as well as their distribution in time.
Export commit data to CSV
To export raw commit data to CSV directly from Bitbucket, you need to go to the People page . There you’ll notice the menu at the top-right corner, where you can choose .
Another way to export commit data to CSV is to use the Awesome Graphs REST API, which allows you to automate the processes and retrieve this data easier using the dedicated resources.
Search for commits in Bitbucket via REST API
Bitbucket REST API provides a possibility to get the list of all commits in the repository using this request.
The request can be extended by specific parameters to receive a more accurate result. For instance, since and until options help to get the commits made after or before a certain commit, or between two commits defined by their IDs. Merges parameter controls how to handle merge commits — exclude merge commits, include both merge commits and non-merge commits, or only return merge commits.
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.
"name": "Max Desiatov",
"name": "Tomer Doron",
"message": "Add internal section link to README.md (#71)",
Alternatively, you can 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.
The response will look as follows:
"slug": "Commit Hook",
Learn more about the available REST API resources.
Find out what works best for you
We’ve described different ways to work with commits effectively:
- Sourcetree as a free application that is suitable for searching among a small number of repositories.
- Awesome Graphs for Bitbucket add-on as a tool with wide search opportunities and various analytical features.
- Bitbucket REST API as a more advanced and technically demanding option.
Try them all and find the best solution!
Originally published at https://stiltsoft.com on May 17, 2021.