Skip to content

Latest commit

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

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]
FlagDescriptionDefault
-s, --styleOutput style: line, sideline
-cs, --colorSchemeColor scheme: auto, dark, lightauto
--summaryShow file summarytrue
-t, --titlePage title for HTML output"Diff to HTML"
-f, --formatOutput format: html, jsonhtml
-i, --inputInput source: file, command, stdincommand
-o, --outputOutput destination: preview, stdoutpreview
-F, --fileWrite output to file
-v, --versionShow version
-h, --helpShow 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

About

Convert git diff to html using Go

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages