Skip to content

Instantly share code, notes, and snippets.

@ajhsu
Forked from thbar/how-to-diff-pdf-files-with-git-and-diffpdf.md
Last active September 6, 2018 10:42
Show Gist options
  • Save ajhsu/df731bec9f96b5a44f8ff88afdc275f8 to your computer and use it in GitHub Desktop.
Save ajhsu/df731bec9f96b5a44f8ff88afdc275f8 to your computer and use it in GitHub Desktop.
How to diff PDF files with Git

One can use MD5 or plain text diff to see differences in PDF files. If that's not enough, here's how to use diffpdf 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 \"$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.

@ajhsu
Copy link
Author

ajhsu commented Sep 6, 2018

Diff PDFs in OSX

$ brew cask install xquartz
$ brew install diff-pdf
$ diff-pdf --view A.pdf B.pdf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment