git diff: what is the difference between --cached and --staged

蹲街弑〆低调 提交于 2019-12-03 09:34:39

The documentation for git diff says "--staged is a synonym of --cached", so yes.

From the docs - --staged is a synonym of --cached

git-scm.com/docs/git-diff (see bolded text):

git diff [<options>] --cached [<commit>] [--] [<path>…​]

This form is to view the changes you staged for the next commit relative to the named <commit>. Typically you would want comparison with the latest commit, so if you do not give , it defaults to HEAD. If HEAD does not exist (e.g. unborn branches) and is not given, it shows all staged changes. --staged is a synonym of --cached.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!