Skip to content

Instantly share code, notes, and snippets.

@christiantakle
Forked from kaspergrubbe/git_tag.rb
Created July 27, 2013 11:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save christiantakle/6094587 to your computer and use it in GitHub Desktop.
Save christiantakle/6094587 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