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.4.0.tar.gz (9.3 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.4.0-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for gdiff-0.4.0.tar.gz
Algorithm Hash digest
SHA256 f6c17cdfac8b6db1a1de95a890f225657b3212594d4f298442021585e7f8e8d9
MD5 2c7382af94ef7e2175c83a09942436fc
BLAKE2b-256 c78cd1c99b9619bf6d7dfb8e19c3c76139439b9c9051f8dbbf8b3746b1a7bfd3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: gdiff-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 11.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.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a1174bd0501b13b91a06d539b28eb983d0ccc3577a01a2bae8ba027c3383117f
MD5 4552d9e13e5c41e8fcc875036d606ade
BLAKE2b-256 2a0cb6df8422046dc5d54a931b603876f9f99fc346687a5316e36c8b19c133ba

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