views:

205

answers:

1
+2  Q: 

Git-diff to HTML

Hi,

I'm looking for a way to produce HTML files from a git-diff output, preferably using python. I've been looking at http://docs.python.org/library/difflib.html without being able to figure out how to use the git-diff output as an input.

Any clue?

Many thanks

+2  A: 

You could use the pygments commandline script to get a syntax highligthed HTML output.

Installation:

$ easy_install Pygments

Example:

$ git diff HEAD^1 > last.diff
$ pygmentize -f html -O full,style=trac -l diff -o last.diff.html last.diff

$ # mac only
$ open last.diff.html

Or shorter:

$ git diff | pygmentize -f html -O full,style=emacs -l diff

P.S. To see all available styles, try:

$ pygmentize -L styles
The MYYN
Thanks, however this is not exactly what I'm looking for. I'm sorry my question wasn't clear enough, and maybe it is indeed something to look at, but I'm afraid pygment is limited to syntax highlighting. Regular diff outputs use "ascii" to graphically show the differences between two files, what'd like to do is to show thoses differences graphically, either by displaying the two files side by side (like wikipedia) or for instance by using css attributes like 'overline' to show deleted chunks.
kifkif