Jira ticket number between git branches

Have you ever worked on a team where everyone needed to put the Jira ticket number in the git message? Ever wanted to know all the ticket being merge to another branch before doing so?

Here is a nifty little bash function that you can put in your bash profile:

gitjira (){ git log $1...$2 | grep -o -E '\b([A-Z]+)-[0-9]+\b' | sort | uniq; }

Once you have this included, you can now compare 2 branches together like so:

gitjira master stage