What is the difference between git diff HEAD vs. git diff --staged?

前端 未结 5 670
予麋鹿
予麋鹿 2021-01-29 19:18

What is the difference between git diff HEAD and git diff --staged? I tried both but both give the same output.

5条回答
  •  时光说笑
    2021-01-29 20:09

    Another edge case difference: In a newly created git repo, where only git init has been run so far, git diff HEAD will result in a fatal error (ambiguous argument 'HEAD') while git diff --staged will produce no output.

提交回复
热议问题