QuestionQ437

Software Development and Design

A developer modified a project and has already staged the files in Git for commit. The developer learns that a colleague has also been working on the same Git project. Before finalizing the commit, which Git command identifies changes made since the most recent commit?

  • A git diff HEAD
  • B git diff
  • C git status
  • D git diff --cached
Explanation

git diff --cached displays the staged changes—the contents of the index—compared with HEAD, which represents the latest commit. It is used to review exactly what will be included in the next commit.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!