nerdexam
Cisco

200-901 · Question #629

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…

The correct answer is A. git diff HEAD. The command git diff HEAD is used to compare the current state of the working directory (including staged changes) with the last commit. This helps the developer identify changes that have been made since the last commit, which is useful when a colleague has also been working…

Software Development and Design

Question

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?

Options

  • Agit diff HEAD
  • Bgit diff
  • Cgit status
  • Dgit diff --cached

How the community answered

(48 responses)
  • A
    77% (37)
  • B
    13% (6)
  • C
    4% (2)
  • D
    6% (3)

Explanation

The command git diff HEAD is used to compare the current state of the working directory (including staged changes) with the last commit. This helps the developer identify changes that have been made since the last commit, which is useful when a colleague has also been working on the same project.

Topics

#Git commands#Version control#Git diff#Staging area

Community Discussion

No community discussion yet for this question.

Full 200-901 Practice