【git命令】git diff

git diff

1. 显示暂存区和工作区的差异:

git diff [file]

 

2. 显示暂存区和上一次提交(commit)的差异:

git diff --cached [file] 
# 或者用下面的命令
git diff --staged [file]

 

 

3. 显示两次 commit 提交之间的差异:

$ git diff [first-branch]...[second-branch]

例如:

git diff 9f38a28ebd94f3ab833c25c0645ceb24a090c260 6bf732d0fc7bed24b42dd4290373e39b802500ff

 

posted @ 2022-05-12 09:36  苏格拉底的落泪  阅读(57)  评论(0编辑  收藏  举报