GIT-LATEXDIFF(1)

πŸ’… GIT-LATEXDIFF β€” ok bestie, let's diff some LaTeX

Hiii welcome to git-latexdiff, the git-latexdiff(1) era of your life πŸ’–. Basically? It calls latexdiff on two Git revisions of a file. That's the whole vibe. Two versions of your paper, one gorgeous red-trike/blue-underline glow-up. Slay.


✨ OPTIONS ✨

First, the shapes this thing can take, fr fr:

Usage: git latexdiff [options] OLD [NEW]
       git latexdiff [options] OLD --
       git latexdiff [options] -- OLD

Call latexdiff on two Git revisions of a file. That's the mission 🫢

OLD and NEW are Git revision identifiers. NEW defaults to HEAD. And if you use -- for NEW? Then bestie we're diffing against the working directory πŸ‘‘

Now the actual options, one by one, no skips, no cap:

  • --help β€” this help message πŸ’¬
  • --help-examples β€” show examples of usage (the receipts ✨)
  • --main <file> β€” name of the main LaTeX, R Sweave, or Emacs Org mode file. If you don't specify it, it will attempt to search for the only file containing documentclass. For non-LaTeX files, a reasonable prepare command will be used unless you explicitly provide one.
  • --no-view β€” don't display the resulting PDF file πŸ™ˆ
  • --latex β€” run latex instead of pdflatex
  • --xelatex β€” run xelatex instead of pdflatex
  • --lualatex β€” run lualatex instead of pdflatex
  • --tectonic β€” run tectonic instead of pdflatex
  • --bibtex, --bbl β€” display changes in the bibliography (runs bibtex to generate *.bbl files and include them in the source file using latexpand --expand-bbl before computing the diff)
  • --biber β€” like --bibtex, but runs biber instead.
  • --run-bibtex, -b β€” run bibtex as well as latex to generate the PDF file (pdflatex,bibtex,pdflatex,pdflatex)
NOTE: --bibtex usually works better πŸ‘€
  • --run-biber β€” run BibLaTex-Biber as well as latex to generate the PDF file (pdflatex,biber,pdflatex,pdflatex)
NOTE: --biber usually works better πŸ‘€
  • --view β€” view the resulting PDF file (this is the default if -o is not used)
  • --pdf-viewer <cmd> β€” use <cmd> to view the PDF file (default: $PDFVIEWER)
  • --no-cleanup β€” don't cleanup temp dir after running
  • --no-flatten β€” don't call latexpand to flatten the document
  • --cleanup MODE β€” Cleanup temporary files according to MODE:
    • keeppdf (default): keep only the generated PDF file
    • none: keep all temporary files (may eat your diskspace 😭)
    • all: erase all generated files. Problematic with --view when the viewer is e.g. evince, and doesn't like when the file being viewed is deleted. πŸ’€
  • --latexmk β€” use latexmk
  • --build-dir β€” use pdfs from specific build directory
  • --latexopt β€” pass additional options to latex (e.g. -shell-escape)
  • -o <file>, --output <file> β€” copy resulting PDF into <file> (usually ending with .pdf). Implies --cleanup all
  • --tmpdirprefix β€” where temporary directory will be created (default: /tmp). Relative path will use repository root as a base
  • --verbose, -v β€” give more verbose output πŸ—£οΈ
  • --quiet β€” redirect output from subprocesses to log files 🀫
  • --prepare <cmd> β€” run <cmd> before latexdiff (e.g. run make to generate included files)
  • --filter <cmd> β€” run <cmd> after latexdiff and before compilation (e.g. to fix up latexdiff output)
  • --ln-untracked β€” symlink uncommited files from the working directory
  • --ln-untracked-dir <dir> β€” symlink subdirectory of uncommited files (relative to the main .tex file)
  • --version β€” show git-latexdiff version.
  • --subtree β€” checkout the tree at and below the main file (enabled by default, disable with --whole-tree)
  • --whole-tree β€” checkout the whole tree (contrast with --subtree)
  • --ignore-latex-errors β€” keep on going even if latex gives errors, so long as a PDF file is produced πŸ’ͺ
  • --ignore-makefile β€” ignore the Makefile, build as though it doesn't exist
  • -* β€” other options are passed directly to latexdiff
  • --latexpand OPT β€” pass option OPT to latexpand. Use multiple times like --latexpand OPT1 --latexpand OPT2 to pass multiple options.
  • --latexdiff-flatten β€” use --flatten from latexdiff instead of latexpand
  • --early-exit-if-equal β€” if two files are identical latexdiff will not be called and git-latexdiff exits gracefully. This option works only if latexpand is used
Unrecognized options are passed unmodified to latexdiff. Bestie behavior honestly πŸ₯°

🌈 EXAMPLES 🌈

Diff the previous revision with the latest commit:

git latexdiff HEAD^

Diff the latest commit with the working tree:

git latexdiff HEAD --

Diff latest commit with branch master:

git latexdiff master HEAD

Pass --type=CHANGEBAR to latexdiff to get changebars in the margins instead of red+trike/blue+underline diff:

git latexdiff --type=CHANGEBAR HEAD^

Use a specific latexdiff configuration file:

git latexdiff --config /path/to/file HEAD^

Add a \makeatletter statement to hopefuly fix some LaTeX compilation errors involving commands containing an @ character:

git latexdiff --latexpand --makeatletter HEAD^

Ok that's the whole page bestie, you ate πŸ’… One last thing β€” this little icon of a manual is dated 07/23/2025 and it lives under the name GIT-LATEXDIFF(1) (that's the source/version energy right there). Go forth and make your diffs iconic πŸ¦‹βœ¨πŸ‘‘