generating release notes from Git commits
So you need to generate some release notes and you already have pretty good Git commit messages. Start by adding this little Ruby script to your path as format_release_notes.rb
:
#!/usr/bin/env ruby
log = ARGF.read
formatted = log.gsub(/commit ([\da-f]{40})\nAuthor: .*\nDate: +.*\n\n {4}(.*)\n(?:\ {4}.*\n)*/, '|\1|\2|')
puts formatted
Then in your .gitconfig
add this:
release-notes = "!sh -c 'git log $(git rev-parse --abbrev-ref HEAD) --no-merges --not master | format_release_notes.rb' -"
Now you can ask Git for release notes like so:
git release-notes
It will give you the commits in your current branch that are not in master
, then format them in a way that's suitable for a Markdown table (minus the header).
Written by Rob Friesel
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Git
Authors
khasinski
591.1K
dmichaelavila
500.4K
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#