Skip to content

Instantly share code, notes, and snippets.

@bhameyie
Last active August 29, 2015 13:57
Show Gist options
  • Save bhameyie/9368099 to your computer and use it in GitHub Desktop.
Save bhameyie/9368099 to your computer and use it in GitHub Desktop.
Getting change logs between latest and previous tags
`git fetch --tags`
tag_name = `git describe --abbrev=0`.split("\n")[0]
current_tag= tag_name.gsub(".","").to_i
tags_dictionary = Hash[`git tag`.split("\n").map{|tag| [tag.gsub(".","").to_i, tag]}]
tags = `git tag`.split("\n").collect{|tag| tag.gsub(".","").to_i}
tags.sort
tagIndex= tags.index(current_tag)
previous_tag=tags[tagIndex-1]
change_logs= `git log #{tags_dictionary[previous_tag]}..#{tag_name} --format=%s`.split("\n")
puts change_logs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment