CS FundamentalsVery hardProduct-company placement · Git interview

A repository has untracked files temp.txt and out/build.log; *.log is in .gitignore. What does git clean -fd remove?

  1. A. temp.txt and the out/ folder with build.log
  2. B. temp.txt only; out/build.log is ignored and out/ is left
  3. C. Nothing, because -n is required first
  4. D. Both files and every ignored file in the repository

Correct answer: B. temp.txt only; out/build.log is ignored and out/ is left

git clean -fd removes untracked files and directories but not ignored files (that needs -x). out/ contains only an ignored file, so clean leaves it. -n is an optional dry run, not a requirement.

More Software Engineering, Git and Cloud Basics questions

Exams that ask this topic