Diff
一句话解释
diff shows 精确行 那个是 添加, 移除, or 更改之间 two versions 的你的 files.
用大白话说
git diff shows differences 之间 two 状态的 你的仓库. 行 prefixed 使用 - 是移除; 行 prefixed 使用 + were added. The diff format also shows file names and line numbers for context.
Common uses: git diff (unstaged changes), git diff --staged (staged changes), git diff <branch1> <branch2> (differences between branches), and git diff <commit1> <commit2> (differences between two commits).
Diffs are essential for code review — they show exactly what a commit or pull request changes. Reading diffs is a core developer skill. The output can be large, so tools like git diff --stat (show only file names and change counts) or visual diff tools are helpful.
示例
# See unstaged changes
git diff
# See staged changes
git diff --staged
# Compare two branches
git diff main feature
# Summary of changes
git diff --statdiff shows 行-通过-行更改. - 平均值移除, + 平均值添加.
相关术语
相关资源
相关课程
解读错误信息
用大白话解释常见错误——什么意思、为什么发生、如何修复。