Search

Search IconIcon to open search

Git Diff Report (HTML, txt)

Last updatedUpdated: by Simon Späti · CreatedCreated: · 1 min read

Export a git difftool as text, HTML, PDF, or image for seeing and sharing changes with others in a nice visual way.

# Text

Simple text diff, use delta diff for nice view:

1
2
3
4
5
# Plain diff to file
git diff > changes.txt

# Word-level diff (best for prose/markdown)
git diff --word-diff > changes.txt

Looks:

# HTML Report (PDF)

diff2html-cli produces a GitHub-style side-by-side diff.

1
2
3
4
5
6
7
yay -S diff2html-cli

# Preview in browser
git diff | diff2html -i stdin -o preview

# Save to HTML file
git diff | diff2html -i stdin -F changes.html

How it looks:

If you want a PDF, just print is and save as PDF.

Hunk cli

There’s also git hunk, a newer modern diff.

# For prose/markdown Files Specifically

--word-diff shows inline additions/removals — clearest for non-technical clients:

1
git diff --word-diff=color path/to/file.md

Origin: git