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!
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.
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!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.