What is the difference between staging and caching?

前端 未结 2 841
无人及你
无人及你 2021-01-04 20:09

I\'m reading the book Pro Git, second edition.

It says, on page 21:

git diff --staged This command compares your staged changes t

相关标签:
2条回答
  • 2021-01-04 20:33

    They are synonymous; from the Git docs:

    This form is to view the changes you staged for the next commit relative to the named . 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.

    0 讨论(0)
  • 2021-01-04 20:36

    The “staging area”, or “cache” are both synonyms for the same thing which has another name in most other contexts in Git: The index.

    The index is the area where changes are staged when you add them using git add (or git rm). It’s the set of changes that is committed when you do git commit.

    All three names are usually used synonymously, although “cache” is rarely used outside of the --cached parameter in git diff.

    0 讨论(0)
提交回复
热议问题