Tsallaka zuwa abun ciki
Justice Tech School

Cleaning Untracked Files

git clean -n shows what would be deleted and -f deletes. -d includes folders.

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 | sort
git clean -fdq
git status -s | wc -l

Result

Would remove junk.txt
0

Exercise

Dry run.

git clean 

Quiz Test

Why -n first?

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