Skip to content

Instantly share code, notes, and snippets.

@jhjguxin
Created August 6, 2012 07:40
Show Gist options
  • Save jhjguxin/3271961 to your computer and use it in GitHub Desktop.
Save jhjguxin/3271961 to your computer and use it in GitHub Desktop.
Git diff 比较不同版本的差异

Git 比较不同版本文件差异的常用命令格式:

git diff                                       查看尚未暂存的文件更新了哪些部分

git diff filename 查看尚未暂存的某个文件更新了哪些

git diff –cached                    查看已经暂存起来的文件和上次提交的版本之间的差异

git diff –cached filename 查看已经暂存起来的某个文件和上次提交的版本之间的差异

git diff ffd98b291e0caa6c33575c1ef465eae661ce40c9 b8e7b00c02b95b320f14b625663fdecf2d63e74c 查看某两个版本之间的差异

git diff ffd98b291e0caa6c33575c1ef465eae661ce40c9:filename b8e7b00c02b95b320f14b625663fdecf2d63e74c:filename 查看某两个版本的某个文件之间的差异
@chensixiu
Copy link

6年前的笔记,对6年后的我来说还是有用的

@djlxiaoshi
Copy link

终于弄清楚了,好多次来了一个git diff 发现什么都没有,都不知道是什么情况

@jiapengwen
Copy link

--cached

@lbq1223android
Copy link

7年前的笔记 现在看来 还是很棒!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment