Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 20 lines (16 sloc) 503 Bytes
#!/usr/bin/env ruby
#
# Usage: git-tag-versions ARGUMENTS_FOR_GIT_LOG
#
# Tags all commits that have a version number in their message.
#
# Written in 2010 by Suraj N. Kurapati <https://github.com/sunaku>
require 'shellwords'
`git log #{ARGV.shelljoin} --format=oneline`.lines.reverse_each do |line|
commit, message = line.split(' ', 2)
if version = message[/^Version (\d+(?:\.\d+)+)/, 1]
version.insert 0, 'v'
p version => commit
system 'git', 'tag', '-f', version, commit
end
end