Last active
August 3, 2016 06:01
-
-
Save bweir/cd8e0b9483d7df9ef780759d473ca469 to your computer and use it in GitHub Desktop.
Fancy Markdown Git Changelog in 25 lines or less
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
OUT="changelog.md" | |
echo "$(basename $(git rev-parse --show-toplevel)) Changelog" > $OUT | |
echo "----------------------" >> $OUT | |
echo >> $OUT | |
git log --format=format:" - %d %s" \ | |
| sed -e '/Merge /d' \ | |
-e '/Update/d' -e '/update/d' \ | |
-e '/README/d' -e '/readme/d' \ | |
-e '/AUTHORS/d' -e '/COPYING/d' -e '/LICENSE/d' \ | |
-e '/authors/d' -e '/copying/d' -e '/license/d' \ | |
-e '/WIP/d' \ | |
-e '/ci skip/d' \ | |
-e '/skip ci/d' \ | |
| sed -e 's/[ \t]*-[ \t]*(tag: \([^)]\+\)) \(.*\)/\n**v\1**\n\n - \2/g' \ | |
| sed -e 's/[ \t]*-[ \t]*([^)]\+, tag: \([^)]\+\), [^)]\+, [^)]\+) \(.*\)/**v\1**\n\n - \2/g' \ | |
| fold -s \ | |
| sed -e '/^\( -\|\*\*\)/!s/^/ /' \ | |
| sed -e 's/\[.*\]/`&` /g' \ | |
| sed -e 's/[a-zA-Z0-9_]\+([a-zA-Z0-9, ]*)/`&`/g' \ | |
| sed -e 's/[a-zA-Z]\+_[a-zA-Z0-9_]*/`&`/g' \ | |
>> $OUT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment