Skip to content

Latest commit

 

History

History
76 lines (54 loc) · 1.69 KB

File metadata and controls

76 lines (54 loc) · 1.69 KB

gitdiffgohtml (gdgh)

A zero-dependency Go CLI that converts git diffs into styled, self-contained HTML pages.

Supports line-by-line and side-by-side views with automatic light/dark theming.

Preview

gitdiffgohtml preview

Features

  • Parse git diff output from command, file, or stdin
  • Render in line or side layout
  • Auto light/dark theme support
  • Optional file-level summary
  • Output as HTML or JSON

Install

go install github.com/garovu/gitdiffgohtml/cmd@latest

Or build from source:

git clone https://github.com/garovu/gitdiffgohtml
cd gitdiffgohtml
go build -o gdgh ./cmd

Usage

gdgh [flags] [-- git diff args]
Flag Description Default
-s, --style Output style: line, side line
-cs, --colorScheme Color scheme: auto, dark, light auto
--summary Show file summary true
-t, --title Page title for HTML output "Diff to HTML"
-f, --format Output format: html, json html
-i, --input Input source: file, command, stdin command
-o, --output Output destination: preview, stdout preview
-F, --file Write output to file
-v, --version Show version
-h, --help Show help

Examples

# Diff last commit and open preview in browser
gdgh

# Diff last 3 commits with rename detection
gdgh -- -M HEAD~3

# Side-by-side view, write to file
gdgh -s side -F output.html -- HEAD~1

# Read from a diff file
gdgh -i file my.diff

# Pipe from stdin, side-by-side
cat my.diff | gdgh -i stdin -s side

# Output as JSON
gdgh -f json -o stdout -- HEAD~1

License

MIT