git-diff
Display git changes in GitHub-style unified diff format.
Execution
Run the Python script to display formatted diff:
python3 scripts/github_diff.py [optional-path]
Output Format
- File headers: Dark background with filepath
- Line numbers: Two columns (old | new)
- Deletions: Red background with
-marker - Additions: Green background with
+marker - Context: Neutral with both line numbers
- Chunk markers: Cyan
@@ -n,m +n,m @@headers
Sections
- Staged Changes (
git diff --cached) - shown first if present - Unstaged Changes (
git diff) - working directory modifications
Examples
# Show all changes
python3 scripts/github_diff.py
# Filter by path
python3 scripts/github_diff.py src/components/
Requirements
- Python 3.6+
- Git installed and in PATH
- Terminal with ANSI color support
Scan to join WeChat group