Developing Applications and Automating Workflows Using Cisco Platforms (DEVASC) — Question 517

A developer changed a project and already staged the files in Git ready to be committed. The developer discovers that a colleague has also been working on the same project in Git. Before the commit is finalized, which Git command is used to identify changes after the last commit?

Answer options

Correct answer: D

Explanation

The correct answer is D, 'git diff --cached', which shows the differences between the staged changes and the last commit. Option A, 'git diff HEAD', shows changes between the working directory and the last commit, while option B, 'git diff', displays unstaged changes in the working directory. Option C, 'git status', provides the status of the working directory and staging area but does not show specific differences.