Post #1675455
2026-04-10 13:15 UTC
Qapla' !
Custom Git log formats, Markdown, Pandoc are your friends:
```
git log --patch --pretty=format:"\`\`\`%n%n# Commit %h %s%n%n+ Author :: %an%n+ Email :: %ae%n+ Date :: %ad%n+ Long Commit :: %H%n%n Commit Mesage%n%n\`\`\`%n%s%n%b\`\`\`%n%n Code Difference%n\`\`\`%n" \
| sed '1d' \
| sed '$a```\n' \
| pandoc --from=markdown --to=html5 --table-of-contents --standalone \
--metadata=title:"Git Log for " > -logs.html
```
where `` is the students registration number, and `` are paths to files I am interested in.
Caveats:
+ log format is *just* for logs, so too is `--output`. So if you want to include code changes then you need to capture `stdout`;
+ capturing patches means you need to have a leading end delimiter and a trailing start deliminter;
+ `sed` magic removes the first leading end delimiter, and inserts a final end delimiter;
+ markdown/commonmark to insert raw html for foldable summaries of commit message and code diff
+ pandoc to get standalone html files and tocs
Replies (0)
No replies.