[Tex/LaTex] Using latexdiff with git

gitlatexdiffrevision control

I'd like to be able to use latexdiff with git. At the moment I have an alias in my .gitconfig file for a word-based diff:

[alias]
 wdiff = diff --color-words

but is it possible to make an alias that will use latexdiff then compile the output and open the created dvi/pdf file?

Probably the best approach to this is using git difftool, but has anyone already made an appropriate script?

Best Answer

The most complete and general solution today is probably git-latexdiff, here:

https://gitlab.com/git-latexdiff/git-latexdiff

The script internally checks out the full tree for the specified revisions, and calls latexdiff with the --flatten option (or can call latexpand), hence this works if the document is split into multiple .tex files.

The script contains many special-cases to make it work for as many cases as possible (it received contributions from more than 10 contributors, most of them being "make it work for my use-case too").

Note: I'm the main author.