git clean is the tool you call when your working tree looks like a garage after a party and you want to stop stepping on stray object files. It removes files that are not tracked by version control so you can get back to actual work and not detective mode.
Never skip the preview step unless you enjoy explaining to teammates why a config file vanished. Use the dry run to see what would be removed without changing anything.
git clean -n
git clean -nd
The -n flag shows candidates for deletion. Add -d to include untracked directories in the preview.
git clean -n
Preview removal without deleting anythinggit clean -f
Force delete untracked files from the working treegit clean -fd
Remove files and untracked directoriesgit clean -fdx
Also remove ignored files that git normally skipsgit clean -fdX
Remove only ignored files leaving other untracked items alonegit clean -i
Interactive mode to pick what gets nukedgit will not delete anything without a force flag. That is its only personality trait you can rely on. Use -f to let it do the dirty work. Add -d when your mess includes folders. Use -x if you really want to remove ignored files such as build artifacts. Use -X when you want to remove ignored files but keep other untracked things that may be useful.
If you want surgical precision then use interactive mode. It opens a tiny text prompt where you can choose which files to remove. It feels a bit like being trusted with a tiny red button in a movie.
git clean -i
git clean is great for workspace cleanup when you want to remove stray untracked files. Preview with -n then use -f to actually delete. Use -d to include directories. Use -x or -X only when you know what is ignored in your repo. When unsure use -i and when in doubt make a commit or stash. Follow these steps and your version control life will be slightly less chaotic.
Now go run a dry run and pretend you were never tempted to skip it
I know how you can get Azure Certified, Google Cloud Certified and AWS Certified. It's a cool certification exam simulator site called certificationexams.pro. Check it out, and tell them Cameron sent ya!
This is a dedicated watch page for a single video.