public
Last active

git-hashtags

  • Download Gist
git-hashtags.rb
Ruby
1 2 3 4 5 6 7 8 9
#!/usr/bin/env ruby
commit =`git log -n 1 --oneline`
commit =~ /^([a-z0-9]+).+?#([A-Za-z0-9\._-]+)(?:$| )/
sha,tag = $1,$2
if tag
`git tag #{tag} #{sha}`
commit_without_tag = commit.gsub(/#{sha}/,'').gsub(/##{tag}/,'').strip
`git commit --amend -m "#{commit_without_tag}"`
end

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.