I use the fact you can configure git to use custom diff tools and take advantage of this with the following in my .gitconfig:
[diff "pdf"]
command = ~/bin/git-diff-pdf
And in my .gitattributes I enable the above with:
*.pdf binary diff=pdf
~/bin/git-diff-pdf does a diff of the output of `pdftotext -layout` (from poppler) and also runs pdf-compare-phash.
To use this custom diff with `git show`, you need to add an extra argument (`git show --ext-diff`), but it uses it automatically if running `git diff`.
ImageMagick can do a visual PDF compare:
(density = 100, $1 and $2 are the filenames to compare, $TMP the output file)You need to do some work to support multiple pages, so I use this script:
https://gist.github.com/mbafford/7e6f3bef20fc220f68e467589bb...
This also uses `imgcat` to show the difference directly in the terminal.
You can also use ImageMagick get a perceptual hash difference using something like:
I use the fact you can configure git to use custom diff tools and take advantage of this with the following in my .gitconfig: And in my .gitattributes I enable the above with: ~/bin/git-diff-pdf does a diff of the output of `pdftotext -layout` (from poppler) and also runs pdf-compare-phash.To use this custom diff with `git show`, you need to add an extra argument (`git show --ext-diff`), but it uses it automatically if running `git diff`.