Tsallaka zuwa abun ciki
Justice Tech School

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 --short

Result

Would remove junk.txt

Exercise

Dry run.

git clean 

Quiz Test

Why run clean -n first?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.