200-901 exam dumps

200-901 practice question 33 of 204

Cisco DevNet Associate. Associate level, Cisco. Free question with the correct answer and a full explanation.

200-901 Question 33

Single answer

You are developing a Python script that uses Git to manage a source code repository. You want to compare the changes between the working directory and the latest commit. Which command would you use to achieve this?

  1. A

    git diff

  2. B

    git commit

  3. C

    git log

  4. D

    git checkout

Show answer and explanation

Correct answer: A

Explanation

The 'git diff' command is specifically designed to show the differences between the working directory, staging area, and previous commits. In this scenario, where the goal is to compare changes with the latest commit, 'git diff' is the correct choice. Understanding how to use 'git diff' is essential for developers to track changes in their code efficiently.

  • A. Correct.

    The 'git diff' command is used to compare changes between the working directory and the latest commit or between two commits. This is the correct command to identify differences.

  • B. Incorrect.

    The 'git commit' command is used to save your changes to the local repository but does not allow you to view the differences between the working directory and the latest commit.

  • C. Incorrect.

    The 'git log' command shows the history of commits in a repository, but it does not provide a comparison of changes.

  • D. Incorrect.

    The 'git checkout' command is used to switch between branches or restore files, but it is not used for comparing changes.

Timed practice exam

Take a 200-901 practice test under exam conditions

75 questions in 120 minutes, drawn from this bank, with a score report and a per-question review when you finish.

Start timed exam