查看尚未暂存的更新
git diff
工作区和暂存区
git diff HEAD # 显示工作区与当前分支最新commit之间的差异
git diff HEAD -- ac.txt # 查看工作区和版本库里面最新版本的区别
开发分支与临时分支的差异
git diff ac-dev temp
生成补丁
git diff > ../sync.patch
查看文件
git diff <file> # 比较当前文件和暂存区文件差异
git diff <id1> <id1> <id2> # 比较两次提交之间的差异
git diff <branch1>..<branch2> # 在两个分支之间比较
git diff --staged # 比较暂存区和版本库差异
git diff --cached # 比较暂存区和版本库差异
git diff --stat # 仅仅比较统计信息
显示当天插入、修改、删除信息
git diff --shortstat "@{0 day ago}"