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/kto 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
- Runs
git diff(or reads piped input) - Parses the unified diff into structured data
- Generates a self-contained HTML file with inline CSS/JS
- 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f6c17cdfac8b6db1a1de95a890f225657b3212594d4f298442021585e7f8e8d9
|
|
| MD5 |
2c7382af94ef7e2175c83a09942436fc
|
|
| BLAKE2b-256 |
c78cd1c99b9619bf6d7dfb8e19c3c76139439b9c9051f8dbbf8b3746b1a7bfd3
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a1174bd0501b13b91a06d539b28eb983d0ccc3577a01a2bae8ba027c3383117f
|
|
| MD5 |
4552d9e13e5c41e8fcc875036d606ade
|
|
| BLAKE2b-256 |
2a0cb6df8422046dc5d54a931b603876f9f99fc346687a5316e36c8b19c133ba
|