Posts Git pull list of commit messages since last tag
Post
Cancel

Git pull list of commit messages since last tag

Get the last tag name

1
$ git describe --tags --abbrev=0

Now get all changes from last tag till now

1
$ git log $(git describe --tags --abbrev=0)..HEAD

Extract information using grep

Now grep all commit messages that have JIRA mentioned in them

1
$ git log $(git describe --tags --abbrev=0)..HEAD |grep "JIRA"

Now remove all merge request information

1
$ git log $(git describe --tags --abbrev=0)..HEAD |grep "JIRA" | grep -v "\bCloses\W\|\bMerge branch\W\|\borigin/CISR\|\bResolve\W"

Now sort the commit messages and return only unique records

1
$ git log $(git describe --tags --abbrev=0)..HEAD |grep "JIRA" | grep -v "\bCloses\W\|\bMerge branch\W\|\borigin/CISR\|\bResolve\W" | sort| uniq

Extract information using awk

Use awk to find all commit messages that start with word JIRA

1
$ git log $(git describe --tags --abbrev=0)..HEAD | awk '$1 ~ /^JIRA/'

Now sort the commit messages and return only unique records

1
$ git log $(git describe --tags --abbrev=0)..HEAD | awk '$1 ~ /^JIRA/' | sort | uniq

Extract information by simply using git parameters

1
$ git log --no-merges --oneline --format=%s $(git describe --tags --abbrev=0)..HEAD 
  • –no-merges : remove all merge information
  • –oneline : remove date and author information
  • –format=%s : %s is to return the commit message and removing the commit hash information

Now sort the commit messages and return only unique records

1
$ git log --no-merges --oneline --format=%s $(git describe --tags --abbrev=0)..HEAD | sort | uniq
This post is licensed under CC BY 4.0 by the author.