zhanhongtao / blog

Blog for 91885076(QQ群)
http://github.com/zhanhongtao/blog/issues
24 stars 7 forks source link

git diff #235

Closed zhanhongtao closed 7 years ago

zhanhongtao commented 7 years ago

不同位置/版本的 diff

// 工作区 diff 暂存区
git diff <filename>
// 当 filename 和 branchname 冲突时
git diff -- <filename>

// 工作区 diff 仓库指定版本
git diff <branch> <filename>

// 暂存区 diff 仓库
git diff -–cached <filename>
git diff --cached <branch> <filename>

// 仓库版本之间 diff
git diff <ver> <ver>
git diff <ver>:<filename> <ver>:<filename>

版本快捷方式

HEAD 
HEAD^
HEAD^^
HeAD~{n}