Skip to main content

Web-based inline 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.3.0.tar.gz (8.4 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.3.0-py3-none-any.whl (10.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for gdiff-0.3.0.tar.gz
Algorithm Hash digest
SHA256 869e28d2359a113084e044b177f47835ef8cd91604f8a50ae17303de744d4405
MD5 697c1a42b82002ad3813281f30f8ae0a
BLAKE2b-256 703644ac17a7ad04c453feb675a9f474de2ccbe7ac6639f4e0810730afcdc253

See more details on using hashes here.

File details

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

File metadata

  • Download URL: gdiff-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 10.1 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.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 74ba8154f6e8e2e03e81785b6d1f0c849692bd48f780c0b1b39cda2f424b00ab
MD5 3c8bb2c1023ad233fe4ad2a14ac6fd63
BLAKE2b-256 711958bfff5ee35d991c5a59eec9cb34ffe6f89df07343fc5ee7fc0ef03e812e

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