200-901 · Question #353
A developer completed the creation of a script using Git. Before delivering it to the customer, the developer wants to be sure about all untracked files, without losing any information. Which…
The correct answer is A. git clean -n. 'git clean -n' performs a dry run, listing all untracked files that would be removed without actually deleting anything. The '-n' flag stands for '--dry-run', making it safe for just gathering information. Option B ('git rm -f') forcefully removes tracked files from the index…
Question
A developer completed the creation of a script using Git. Before delivering it to the customer, the developer wants to be sure about all untracked files, without losing any information. Which command gathers this information?
Options
- Agit clean -n
- Bgit rm -f
- Cgit clean -r
- Dgit rm *
How the community answered
(33 responses)- A88% (29)
- B6% (2)
- C3% (1)
- D3% (1)
Explanation
'git clean -n' performs a dry run, listing all untracked files that would be removed without actually deleting anything. The '-n' flag stands for '--dry-run', making it safe for just gathering information. Option B ('git rm -f') forcefully removes tracked files from the index and working tree - destructive. Option C ('git clean -r') recursively deletes untracked directories and files - also destructive. Option D ('git rm *') removes all matching files from Git tracking - also destructive. Only 'git clean -n' is non-destructive and answers the question of listing untracked files safely.
Topics
Community Discussion
No community discussion yet for this question.