Last active
August 29, 2015 13:57
-
-
Save bhameyie/9368099 to your computer and use it in GitHub Desktop.
Getting change logs between latest and previous tags
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
`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