Last Updated: February 25, 2016
·
4.103K
· rstets

List Jira ticket ids from Git log

  1. Prerequisite: Always use Jira ticket id in git commit messages.

  2. Command:

    git log <start commit hash>..<end commit hash> | grep -Eo '([A-Z]{3,}-)([0-9]+)' | uniq
  3. Function (add to, e.g. ~/.bash_profile):

    # Definition
    function git-jira-ids() {
      git log $1 | grep -Eo '([A-Z]{3,}-)([0-9]+)' | uniq
    }
    
    # Usage
    git-jira-ids <start commit hash>..<end commit hash>
  4. Output: List of unqiue Jira ticket ids committed between "start commit hash" and "end commit hash"

  5. Note: You can use tag and branch names instead of commit hash as well

    git log --help