200-901 · Question #386
200-901 Question #386: Real Exam Question with Answer & Explanation
The correct answer is D: Run the git diff --staged command to compare the code added to the staging area.. When changes are made to a file in a local Git repository and staged using git add ., the changes are added to the staging area. To compare the changes between the staging area and the previous commit, you should use the git diff --staged command. The --staged option compares the
Question
A file in a local Git repository has been updated and issued the git add . command. The git diff command has been run to compare the changes to the previous commit, but nothing shows. Which action identifies the problem?
Options
- ARun the git add . command again in the correct subdirectory to ensure changes added to the
- BRun the git commit command before the differences are compared to receive the end state of the
- CRun the git status command to see the differences between current and previous code review
- DRun the git diff --staged command to compare the code added to the staging area.
Explanation
When changes are made to a file in a local Git repository and staged using git add ., the changes are added to the staging area. To compare the changes between the staging area and the previous commit, you should use the git diff --staged command. The --staged option compares the changes in the staging area to the last commit.
Topics
Community Discussion
No community discussion yet for this question.