返回 Skill 列表
extension
分类: 开发与工程无需 API Key

git-diff

以GitHub风格的统一差异格式显示git更改,并带有彩色终端输出。显示已暂存(--cached)和未暂存的更改,包括两列行号、红色/绿色高亮以及块标记。在审查代码更改、准备提交或比较文件修改时使用。触发命令为'git diff'、'show changes'、'what changed' 或 'review diff'。

person作者: jakexiaohubgithub

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

  1. Staged Changes (git diff --cached) - shown first if present
  2. 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