If you are about to delete things from a repository do not improvise. Git gives you neat ways to see what will go away before you commit to regret. Use git status to get a quick look or run a dry run of git clean to list candidates without deleting anything.
git status --untracked-files=normal
# or a focused dry run
git clean -n
# include directories in the dry run
git clean -nd
The -n
flag shows what would be removed without touching a single file. Think of it as a preview mode where you still get to look brave without taking action. If the output looks reasonable you can go further.
# remove untracked files after a dry run
git clean -f
# remove untracked directories too
git clean -fd
# remove everything including ignored files use with extreme caution
git clean -fdx
# interactive selection when you want to be picky
git clean -i
Ignored files are ignored for a reason. They often include build outputs local configs and other noise. If your disk is full or your build artifacts are a mess you can use -x
to include .gitignore entries. Warning this can remove files you actually wanted to keep locally.
If your fingers are faster than your judgement try git clean -i
. It gives a menu so you can approve deletions one screen at a time. This is the human friendly option for when you want to avoid tragic mistakes and awkward explanations to teammates.
In short use git status and git clean -n to preview use git clean -f
and related flags when you are ready and use interactive mode when you want the elegant agony of choosing what stays. Git gives you the tools to avoid catastrophe so use them and enjoy the illusion of control.
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.