Skip to content

Instantly share code, notes, and snippets.

View joseph-henry's full-sized avatar

Joseph Henry joseph-henry

View GitHub Profile
@joseph-henry
joseph-henry / generate_changelog.sh
Created May 13, 2019 22:53
Generate markdown CHANGELOG from git-log with included comparison links
#!/bin/bash
generate_changelog()
{
github_user="user"
github_project_name="project"
first_commit=$(git rev-list --max-parents=0 HEAD)
git for-each-ref --sort=-refname --format="## [%(refname:short)] - %(taggerdate:short) &(newline)*** &(newline)- %(subject) %(body)" refs/tags > CHANGELOG.md
gsed -i '''s/\&(newline)/\n/' CHANGELOG.md # replace first instance
gsed -i '''s/\&(newline)/\n/' CHANGELOG.md # replace second instance