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?
- A. temp.txt and the out/ folder with build.log
- B. temp.txt only; out/build.log is ignored and out/ is left
- C. Nothing, because -n is required first
- 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.
Practise more Software Engineering, Git and Cloud Basics questionsSoftware Engineering, Git and Cloud Basics: notes and key points
More Software Engineering, Git and Cloud Basics questions
- Assertion (A): You should not rebase commits that others have already based work on. Reason (R): Rebasing creates new commits with new…
- You run git branch -d experiment and Git refuses: 'the branch is not fully merged'. You force it with git branch -D. Which statement is…
- While running git rebase main on your feature branch, a conflict appears. In this situation, what do git checkout --ours and --theirs…
- A feature branch is merged into main with git merge --no-ff feature, although main had not moved since feature branched. What is the result?
- A developer wants to find out which commit introduced the string 'legacyPay(' anywhere in the code base, even though the commit messages…
- What does this Prototype-style code print? python import copy class Doc: def init(self, title, tags): self.title = title self.tags = tags…