0

Is there a programmatic way to export git blame from a (text) file to either PDF (preferred) or HTML?

I know that github already offers a blame view in webbrowser (see e.g. here), but in the end I want to do a blame-export for all files in a given repository.

hardmooth
  • 1,202
  • 2
  • 19
  • 36
  • 1
    `git blame` (especially in conjunction with the `-p` switch) produces text output that can be easily parsed and converted to simple HTML files using simple shell scripts (or `awk`, `python`, `perl`, etc) or `pandoc` (for PDF files). – terrorrussia-keeps-killing Sep 30 '21 at 12:28

1 Answers1

0

Since git doesn't offer that itself I ended up with @terrorrussia-keeps-killing comment and wrote a python script:

  1. run git blame --line-porcelain <sha1> -- <fname>
  2. parse the output
  3. generate HTML with jinja2 (see e.g. this tutorial) and save to .html file

(the source is copyright-

hardmooth
  • 1,202
  • 2
  • 19
  • 36