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.0.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.0-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: gdiff-0.2.0.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.0.tar.gz
Algorithm Hash digest
SHA256 b88708bf13bc2bf2b5787f3fc939f0fc71fcd475162d1fb3d3f1b5a5a2c0b23b
MD5 bd528b947e888d34fc0bd74197b16372
BLAKE2b-256 c3130de01be9f543c0642aea4b682fc1acc937071981b8a7320d02a90bd2b1fd

See more details on using hashes here.

File details

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

File metadata

  • Download URL: gdiff-0.2.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 70eff86eaf94835a22a39b04ca423c5359e6f3c991732b1784362e0bcb0406fa
MD5 d6acd137171faec41c4997c7a9c3511b
BLAKE2b-256 33926f0ac2a686e5b47b71e4626cea7cfbc074a31cbadb8fd3032f341c39f518

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