Skip to content

Instantly share code, notes, and snippets.

@aanari
Created May 8, 2012 13:33
Show Gist options
  • Save aanari/2635030 to your computer and use it in GitHub Desktop.
Save aanari/2635030 to your computer and use it in GitHub Desktop.
Visual Studio + Git Changelog Generator
$commitlog = '<!doctype html><html><body>'
foreach($line in git log --no-merges --pretty=%H%n%B){
if ($line -match '\w{40}') {
$commit = git show $line -- Properties/AssemblyInfo.cs
[string] $vers = $commit -match '\+\[assembly: AssemblyVersion\("(\d\.\d\.\d\.\d)"\)\]'
if ($vers) {
$vnum = $vers.Split('\"')[1]
if ($vnum) {
$line = '<hr><span class="version">Version ' + $vnum + ':</span>'
} else {
$line = ''
}
} else {
$line = ''
}
}
if ($line) {
$commitlog += ($line + '<br/>')
}
}
$commitlog += '<style>body{font-family:sans-serif;font-size:0.9em;color:#333;line-height:1.3;}hr{margin:0.75em 0;color:#FCFCFC;background-color:#FCFCFC;}.version{font-weight:bold;font-size:1.1em;color:#777;}</style>'
$commitlog += '</body></html>'
$commitlog | Out-File -Encoding UTF8 Changelog.html
echo "Changelog generated successfully"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment