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 containingdocumentclass. For non-LaTeX files, a reasonablepreparecommand will be used unless you explicitly provide one.--no-viewβ don't display the resulting PDF file π--latexβ runlatexinstead ofpdflatex--xelatexβ runxelatexinstead ofpdflatex--lualatexβ runlualatexinstead ofpdflatex--tectonicβ runtectonicinstead ofpdflatex--bibtex,--bblβ display changes in the bibliography (runsbibtexto generate*.bblfiles and include them in the source file usinglatexpand --expand-bblbefore computing the diff)--biberβ like--bibtex, but runsbiberinstead.--run-bibtex,-bβ runbibtexas well aslatexto generate the PDF file (pdflatex,bibtex,pdflatex,pdflatex)
NOTE: --bibtex usually works better π
--run-biberβ run BibLaTex-Biber as well aslatexto generate the PDF file (pdflatex,biber,pdflatex,pdflatex)
NOTE: --biber usually works better π
--viewβ view the resulting PDF file (this is the default if-ois 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 calllatexpandto flatten the document--cleanup MODEβ Cleanup temporary files according to MODE:keeppdf(default): keep only the generated PDF filenone: keep all temporary files (may eat your diskspace π)all: erase all generated files. Problematic with--viewwhen the viewer is e.g.evince, and doesn't like when the file being viewed is deleted. π
--latexmkβ uselatexmk--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> beforelatexdiff(e.g. runmaketo generate included files)--filter <cmd>β run <cmd> afterlatexdiffand before compilation (e.g. to fix uplatexdiffoutput)--ln-untrackedβ symlink uncommited files from the working directory--ln-untracked-dir <dir>β symlink subdirectory of uncommited files (relative to the main.texfile)--versionβ showgit-latexdiffversion.--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 theMakefile, build as though it doesn't exist-*β other options are passed directly tolatexdiff--latexpand OPTβ pass option OPT tolatexpand. Use multiple times like--latexpand OPT1 --latexpand OPT2to pass multiple options.--latexdiff-flattenβ use--flattenfromlatexdiffinstead oflatexpand--early-exit-if-equalβ if two files are identicallatexdiffwill not be called andgit-latexdiffexits gracefully. This option works only iflatexpandis 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 π¦β¨π
π¦ where this page comes from
- arch rolling: texlive-doc 2026.1-1 Β· GPL
- fedora 43: texlive-git-latexdiff 11:svn75878-95.fc43.1 Β· BSD-3-Clause
- fedora 44: texlive-git-latexdiff 12:svn75878-105.fc44 Β· BSD-3-Clause
- fedora 44: texlive-git-latexdiff 12:svn75878-111.fc44 Β· BSD-3-Clause
- ubuntu resolute: texlive-extra-utils 2025.20260124-1
- ubuntu stonking: texlive-extra-utils 2026.20260711-2
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms