Clean Untracked Files
git clean removes untracked files. Use -n for a dry run first, then -f to do it. -d includes directories.
Example
echo one > a.txt && git add a.txt && git commit -qm 'first'
echo tmp > junk.txt
mkdir out && echo x > out/f
git clean -n
git clean -fdq
git status --shortResult
Would remove junk.txt
Exercise
Dry run.
git clean Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.