一般比较代码差距习惯用Beyond Compare进行比较,然后进行一些定位和解bug操作,现使用了git 工具进行代码比较.
(1)比较两个版本库之间的差距
git log 得到commit SHA
git diff SHA1 SHA2
(2)比较工作区和版本库差异
git diff HEAD
或
git log
git diff (SHA1)
(3)比较工作区和暂存区差异
git diff
(4)比较暂存区和版本库差异
git diff --cached [HEAD]
git diff -- staged SHA