One can use MD5 or plain text diff to see differences in PDF files. If that's not enough, here's how to use diff-pdf which knows how to diff based on appearance or words:
brew install diff-pdf
- edit your
~/.gitconfig
to add this:
[difftool "diffpdf"]
cmd = diff-pdf --view \"$LOCAL\" \"$REMOTE\"
- then use with:
git difftool --tool=diffpdf your_pdf_file.pdf
I suspect there's maybe some way to force always using a specific difftool for files with a specific extension; in the mean time I'm just using a bash function for this.
Also useful in .bash_profile
:
function git_diff_pdf {
yes | git difftool --tool=diffpdf $1
}
then you can use it like:
git_diff_pdf your_pdf_file.pdf
If you use git-annex, you can diff PDFs via
Rationale: The
$LOCAL
and$REMOTE
variables point to temporary files containing the two versions. With git-annex, they contain only a path to the actual file in the.git/annex/objects
store. That's why we need tocat
these files to get the actual path and make them viewed indiffpdf
.Edit:
For some more ninja-coolness, you can use
which makes them paths absolute, so you can execute this from a sub-directory of your repository, too!