🧹 CHAPTER · GIT CLEAN
Chef You

Sweep the
Kitchen Clean

Your workspace is cluttered with files Git doesn't track — build artifacts, temp files, experiments. git clean removes all untracked files in one sweep.

Scene I

The messy kitchen

Chef You

Your project has tracked files (Git knows about them) and untracked junk (Git doesn't know, doesn't care).

git clean -n = dry run (preview what dies)
git clean -f = force delete (actually sweep)
git clean -fd = files + directories

⚠️ This is destructive! Always dry-run first.

🧹 WORKSPACE Step 1: Dry run first!
Spotless!

🎉 Kitchen is clean

All untracked junk is gone. Only your tracked, committed files remain. Clean workspace = clear mind.

Remember: always dry-run first with -n to avoid accidentally deleting something important.

$ git clean -n # preview
Would remove: temp.txt, build/, debug.log
$ git clean -fd # delete
Removing temp.txt
Removing build/
Epilogue
Clean sweeps untracked files.
Always dry-run first.
-f means no going back.

Pair git clean with git checkout -- . to reset everything back to the last commit state.