git-commit-to-html
v1.1.0
Published
Generate HTML diff for git commits
Readme
git-commit-to-html
A CLI tool to generate self-contained HTML diffs for git commits, making it easy to share and visualize code changes.
Installation
From source
git clone https://github.com/flawiddsouza/git-commit-to-html
cd git-commit-to-html
npm install -g .From npm (global)
npm install -g git-commit-to-htmlUsage
Generate diff for the last commit:
git-commit-to-htmlGenerate diff for a specific commit:
git-commit-to-html abc1234Run via npx (no install)
If you prefer not to install globally, you can run it directly with npx:
npx git-commit-to-htmlRun for a specific commit hash:
npx git-commit-to-html abc1234Tips:
- Pin a version for reproducibility:
npx git-commit-to-html@1 - Works inside any git repo with commits and a clean-enough working tree.
The tool will create an HTML file named commit-<hash>-diff.html in the current directory, containing a side-by-side diff view of the changes.
Static mode (no JavaScript)
Add --static to generate a fully static HTML file that includes the diff rendered server-side and contains no JavaScript. This is useful for strict environments or email attachments.
Examples:
# Last commit, fully static
git-commit-to-html --static
# Specific commit, fully static
git-commit-to-html abc1234 --static
# With npx
npx git-commit-to-html --static