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

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


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.


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

Tags:

Git

Git Diff