What does the git diff --cached command show?
a) Differences between the index (staging area) and the last commit
b) Differences between working directory and the index
c) Differences between two commits
d) Differences between local and remote branches
Answer:
a) Differences between the index (staging area) and the last commit
Explanation:
The git diff --cached command shows the differences between the index (staging area) and the last commit. It helps you review the changes that are about to be committed, allowing you to see what has been staged.
For example, running git diff --cached before committing will show you exactly what changes have been staged for the next commit.
This command is crucial for ensuring that only the intended changes are included in a commit.