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 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.
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.
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.
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.
Here is the activity stream with all commits.
Take advantage of the Activity graph to locate all commits to a specific repository.
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.
You can also export commit data to CSV and get a list with detailed information.
To directly export raw commit data to CSV from Bitbucket, go to the People tab and export commit data choosing CSV.
You can also use Awesome Graphs REST API.
We've highlighted different solutions that can help you manage commits:
Tell us about your way of searching commits. Feel free to ask us any questions you have.
Irina Sanikovich _StiltSoft_
0 comments