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

To compare the production with the last commit:

git diff --cached git diff --staged 

Both teams give the same results, right?

+17
source share
3 answers

The documentation for git diff says: --staged is synonymous with -cached , so yes.

+25
source

From docs - --staged is synonymous with --cached

+4
source

git-scm.com/docs/git-diff :

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

This form is designed to view the changes that you have made for the next commit regarding a named <commit> . Typically, you want a comparison with the last commit, so if you don't give it, the default is HEAD. If HEAD does not exist (for example, unborn branches) and is not set, it shows all phased changes. --staged is synonymous with --cached .

0
source

All Articles