git add 是將工做區內容添加到暫存區,git commit是將暫存區內容添加到版本區(master分支);git
$ git diff -- readme.txt //查看工做區與暫存區的差異 $ git diff HEAD -- readme.txt //查看工做區與master分支的差異 $ git diff --cached -- readme.txt //查看暫存區與master分支的差異