工作区和暂存区比较
git diff // 当前工作区和暂存区对比
git diff -- <file name> // 单独文件,当前工作区和暂存区对比
工作区和版本库
git diff HEAD // 工作区和版本库对比
git diff HEAD -- <file name> // 单独文件,工作区和版本库对比
git diff <commitID> // 工作区和某版本库对比
git diff <commitID> -- <file name>
暂存区和版本库
git diff --cached // 暂存区和最新版本库
git diff --cached <commitID> // 暂存区和某版本库
git diff --cached <comitID> -- <fileName>
不同版本库
git diff <commitID> <commitID2>
git diff <commitID> <commitID2> -- <fileName>