Added CHANGELOG function

A basic function to generate CHANGELOG.md from the last 25 commits in a
repository.
This commit is contained in:
2025-04-24 19:37:20 -04:00
parent 2889f7a029
commit 8a6f0a1723

View File

@@ -97,3 +97,18 @@ testmerge() {
git diff --cached git diff --cached
echo "'git merge --abort' when done" echo "'git merge --abort' when done"
} }
git_changelog() {
echo "# Last 25 Commits" > CHANGELOG.md # Add the header
git log --pretty=format:"%h|%ad|%an|%s" --date=short -n 25 | \
awk -F'|' '{
printf "## %s (%s, %s) - %s\n\n", $1, $3, $2, $4;
commit_hash = $1;
cmd = "git show -s --format='%x09%b' " commit_hash;
while ((cmd | getline line) > 0) {
printf "%s\n", line;
}
close(cmd);
printf "\n";
}' >> CHANGELOG.md
}