Skip to content
CodeKruPro

git diff shows nothing, but you changed a file

QuizEasy-MediumAsked in: Accenture, Capgemini, TCS, Wipro

You edit pom.xml and run git add pom.xml. Now git diff prints nothing. Why?

  • git diff compares the working files with the staging area; the change is staged, so use git diff --staged to see it
  • git add discarded the change
  • git diff only works on Java files
  • The change was committed automatically

This question is part of Pro+

Pro+ opens every question in Interview Prep and the mock interview. Every article and the first 2 questions of each topic stay free. Hands-on Selenium and API tasks follow their course lesson's own lock.

See Pro+

Already have Pro+? Sign in