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

how to get Jira ticket number when export commit log

Scarlett Zhao November 30, 2022

I have been tasked with pulling the full commit history for all repositories. The resulting file will be audited by an external and internal auditors. They are requesting the commit log should have repository name, commit date, commit message, branches information, and Jira ticket number so that they can categorized and track the log via Jira tickets.
The way I did now is running the git log below:
git log --branches --tags --remotes --full-history --date-order --format='%ai %an <%ae> %h %f %d' --output commits.csv
which includes most of the information I need except Jira ticket. Is there anyway to get the Jira ticket number?
By the way, I tried to create an API but the token is not working

Thanks in advance for your help!

1 answer

0 votes
Erez Maadani
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 1, 2022

Hey @Scarlett Zhao 

git commits are not aware of Jira, or any other ticketing system. From my personal experience, there are branch name conventions and sometime commit message conventions which contain the Jira ticket. This way, BB knows how to connect the PR to relevant Jira ticket.

If you are using some convention which includes the jira ticket, you could parse it out. 

If you are not using a convention or have commits which don't align with a convention, you might need to do some backward fixing (re-writing the message to include the Jira id).

Recently I've learned that Bitbucket has a feature of commit comment (not the commit message). You might be able to use it for backward fixing without re-writing git history.   

Hope that helps.

Scarlett Zhao December 6, 2022

Hi Erez,

Thank you so much for your reply. Yes I think you are right. If the developer adds Jira ticket number when they commits, Bitbucket will automatically link the commits to Jira ticket, which can be parse it out

Would it be possible if you could give me some advice on how to re-write the git history or how to use commit comment? 

Much appreciated for your help! Thanks!

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events