Approriately change if needed for master and staging.
git log origin/staging..origin/dev --oneline --no-merges
Press enter and grab all the result in clipboard
Store the result in a variable like this. Make sure there are no tilds in the result.
const commits = `CPT-1233: I did something
CPT-4312: You did something`
Modify CPT or DGN according to your jira prefix
const regex = /[CPT,DGN,AP,MBC,DVOP]{2,}-\d{2,}/g
const branches = commits.match(regex)
const branchArray = Array.from(new Set(branches))
const sortedTickets = branchArray.sort(function(a, b) {
let numA = parseInt(a.split('-')[1]);
let numB = parseInt(b.split('-')[1]);
return numA - numB;
});
sortedTickets.join(', ')
You get the unique branches that are going to staging
Bonus:
you can also generate a JQL from above result like below:
"fixVersion = 'v5.9.0 AP Sprint 1 Release' AND key NOT IN ('AP-508', 'CPT-102') order by key ASC"
where 'AP-508', 'CPT-102' can be the result from above and needs to have proper version and sprint
Including
AP
: