Skip to content

Instantly share code, notes, and snippets.

@kaspergrubbe
Created March 21, 2013 17:26
Show Gist options
  • Save kaspergrubbe/5214875 to your computer and use it in GitHub Desktop.
Save kaspergrubbe/5214875 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
tagname = ARGV.pop
def prompt(*args)
print(*args)
gets.chomp
end
if tagname.nil?
STDOUT.puts "No tag given, usage: git_tag.rb tagname"
exit 1
else
cmd = system("git tag -a #{tagname} -m 'Tagging for release: #{tagname}'")
if cmd
answer = prompt("Tag '#{tagname}' created! Do you want to push it to origin? (y/n)")
if answer == 'y'
system("git push origin #{tagname}")
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment