Skip to main content

Web-based side-by-side git diff viewer

Project description

gdiff

A web-based side-by-side git diff viewer. Generates a self-contained HTML page with syntax highlighting and opens it in your browser.

No more squinting at terminal diffs - see your changes clearly, side by side.

Installation

pip install gdiff

For syntax highlighting (recommended):

pip install gdiff[highlight]

Quick Start

gdiff path/to/file.py

This runs git diff on the file, generates an HTML page, and opens it in your browser.

Usage

# Diff a specific file
gdiff path/to/file.py

# Staged changes
gdiff --staged path/to/file.py

# All unstaged changes
gdiff

# Pipe mode
git diff | gdiff

# Save without opening browser
gdiff --no-open -o diff.html

# Compare branches/commits
gdiff main..feature -- path/to/file.py

# Check version
gdiff --version

Features

  • Side-by-side view - old code on the left, new code on the right
  • Syntax highlighting - 500+ languages via Pygments
  • Dark theme - GitHub-dark inspired, easy on the eyes
  • Line numbers - on both sides for quick reference
  • File navigation - sticky header with clickable jump links
  • Keyboard navigation - j/k to jump between files
  • Multi-file support - view all changed files in one page
  • Zero config - works out of the box, no setup needed
  • Fully offline - self-contained HTML, no external dependencies
  • Lightweight - pure Python, no heavy frameworks

How It Works

  1. Runs git diff (or reads piped input)
  2. Parses the unified diff into structured data
  3. Generates a self-contained HTML file with inline CSS/JS
  4. Opens it in your default browser

The generated HTML has no external dependencies - it works fully offline.

Requirements

  • Python 3.8+
  • Git (must be available in PATH)
  • Pygments (optional, for syntax highlighting)

Contributing

Contributions are welcome! Feel free to open an issue or submit a pull request.

License

MIT - Younes Boukdir

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gdiff-0.2.1.tar.gz (8.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gdiff-0.2.1-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

File details

Details for the file gdiff-0.2.1.tar.gz.

File metadata

  • Download URL: gdiff-0.2.1.tar.gz
  • Upload date:
  • Size: 8.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.2

File hashes

Hashes for gdiff-0.2.1.tar.gz
Algorithm Hash digest
SHA256 7ede6e374b2451add50f652593bb7b66eb90c310963fb0b2b652a78c8e5fd64c
MD5 1751cfed6c17de1940be4148aa2d513e
BLAKE2b-256 da17a40be01fa9a96fa0cf544509a94203a9c234b7eb62f933e9bf4ebec6bd69

See more details on using hashes here.

File details

Details for the file gdiff-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: gdiff-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 10.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.2

File hashes

Hashes for gdiff-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f7a98b0672f92326fcd9a6bf209a58bc4181f30b4b25960deb40c49c30be05b4
MD5 b5db8d44bcc54027cbeb5d9d27094361
BLAKE2b-256 19be5b1238d8f384ea341dbedf1576ce38ab5a967663b5e841c86afb5c6824e0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page