What does the git diff command show?

What does the git diff command show?

a) The differences between the working directory and the staging area
b) The commit history
c) The list of branches
d) The differences between two commits

Answer:

a) The differences between the working directory and the staging area

Explanation:

The git diff command shows the differences between the working directory and the staging area. It helps you see the changes that have been made but not yet staged for commit.

For example, if you’ve edited files but haven’t run git add yet, git diff will display the modifications you’ve made.

This command is essential for reviewing changes before staging or committing them to ensure only the intended changes are included.

Reference:

Top 100 Git and GitHub MCQ Questions and Answers

Scroll to Top