Interview Prep/Git & GitHub/Commits, branches and tags

What is `git clean` and how do you use it safely?

BeginnerConceptCommits, branches and tags
Answer

It deletes untracked files. It is destructive and bypasses the reflog, so always dry-run first. -d includes directories, -x also removes ignored files, -n previews.

git clean -ndx
git clean -fd
All Git & GitHub questions Roadmap: Git & GitHub

More on Commits, branches and tags