Jira – Extract the key from the commit

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

For example, we can need it to do some release notes or other things.

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


You need to replace PRJ by your project:


Example of usage

Extract the Jira key from all commits between 2 tags:

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

This permits us to obtain a clear list like:


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