Skip to content

Instantly share code, notes, and snippets.

@FredKSchott
Created August 18, 2014 15:47
Show Gist options
  • Save FredKSchott/0019a2131df9bebb7b3b to your computer and use it in GitHub Desktop.
Save FredKSchott/0019a2131df9bebb7b3b to your computer and use it in GitHub Desktop.
Generating a Changelog with Git - ShellJS Recipes - http://shelljs-recipes.tumblr.com/
// dependencies: a git repo, git tag release versioning
function generateChangeLog(lastRelease, nextRelease) {
echo('Generating Changelog from ' + lastRelease + ' to ' + nextRelease);
('## ' + nextRelease + '\n').to('CHANGELOG.tmp');
exec('git log ' + lastRelease + '...' + nextRelease + ' --pretty=format:"+ \`%h\` - %s" >> CHANGELOG.tmp');
cat("CHANGELOG.tmp", "CHANGELOG.md").to("CHANGELOG.new.md");
mv("CHANGELOG.md", "CHANGELOG.old.md");
mv("CHANGELOG.new.md", "CHANGELOG.md");
rm("CHANGELOG.tmp");
rm("CHANGELOG.old.md");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment