To compare the staged with the last commit:
git diff --cached
git diff --staged
Both commands generate the same results, right?
Join Stack Overflow to learn, share knowledge, and build your career.
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.
gitcli
manual page (rungit help cli
to get it displayed) which explains how these options differ where they differ. It's a lesser-known fact of Git -- that it's actually shipped with a set of documentation pages which explain the terminology, the basics, and even feature a tutorial and explanation of a set of common workflows. You can start withgit help git
;-) – kostix Oct 5 '16 at 16:17