git diff filepath 工作区与暂存区比较
git diff HEAD filepath 工作区与HEAD ( 当前工作分支) 比较
git diff --staged 或 --cached filepath 暂存区与HEAD比较
git diff branchName filepath 当前分支的文件与branchName 分支的文件进行比较
git diff commitId filepath 与某一次提交进行比较
git diff branchA branchB --full-index 比较两个分支
git diff commitA commitB 比较同一个分支下两次commit
转载于:https://www.cnblogs.com/brainstorm/p/9103746.html