logo jira

Sometimes, we need to get Jira key for a later usage.

For example, we can need it to do sme release notes, or other thing.

This is the regex that I use with an example of usage.

Regex

You need to replace PRJ by your project:

'((PRJ-)+([0-9]*)?)'

Example of usage

Extract Jira key from all commit between 2 tags:

git log rs420..rs422  --pretty=oneline | grep -oE '((PRJ-)+([0-9]*)?)' | sort -u

This permit to obtain the clear list like:

PRJ-4056
PRJ-4057
PRJ-4105
PRJ-4189

The job is done, very easily and can be used for a lot of things like interacting with Jira API if needed.