What is the difference between the commands 'git diff –staged' and 'git diff –cached'

I have just started learning git. I have a confusion between the commands git diff --staged and git diff --cached.

  • Git repositories on VS Solutions instead of Projects
  • git push with post-receive slow
  • Managing Liquibase with GitFlow development model
  • How to create branch for the single file?
  • If a git pull request is still pending, how do I continue working across branches?
  • Using git from the command line after installing Github for Mac
  • When someone has cherry-picked from my git commits and made commits of their own, how do I merge?
  • Unable to use key file Eclipse
  • Can I push to both “origin” and “alt” in one command?
  • Clone a git repository all the way back to a specific commit, but not everything
  • git submodule push?
  • How do I commit a git tag?
  • 2 Solutions collect form web for “What is the difference between the commands 'git diff –staged' and 'git diff –cached'”

    In old version of git the staging area is refereed to as cache/stage area.
    Today it’s being called index.

    From the docs:

    --staged is a synonym of --cached.

    Stage/cache/index are all synonyms for the staging area. It simply depends on the git version you use. It was change to index along the way (and today it’s called index), but they are still a few command which use --cached along the way, like git diff, git rm --cached etc.

    Git Workflow

    There is no difference between these two. From git diff docs:

    --staged is a synonym of --cached.

    You can read more about it in SO docs.

    Git Baby is a git and github fan, let's start git clone.