Show git diff on file in staging area
Possible Duplicate:
How do I show the changes which have been staged?
Is there a way I can see the changes that were made to a file
after I have done git add file
?
That is, when I do:
git add file
git diff file
no diff is shown. I guess there's a way to see the differences since the last commit but I don't know what that is.
You can show changes that have been staged with the --cached
flag:
$ git diff --cached
In more recent versions of git, you can also use the --staged
flag ( --staged
is a synonym for --cached
):
$ git diff --staged
为了查看已经执行的更改,可以将-–staged
选项传递给git diff
(在Git的1.6之前版本中,使用–-cached
)。
git diff --staged
git diff --cached
try git diff HEAD file
?
See the EXAMPLE
section under git-diff(1)
上一篇: 如何查看git commit中的更改?
下一篇: 在临时区域显示git diff文件