Skip to content

Instantly share code, notes, and snippets.

@ashaw
Created February 14, 2011 19:08
Show Gist options
  • Save ashaw/826360 to your computer and use it in GitHub Desktop.
Save ashaw/826360 to your computer and use it in GitHub Desktop.
git-hashtags
#!/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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment