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
More on Commits, branches and tags
How do you write a good commit message?BeginnerWhat is the difference between `git add .`, `git add -A` and `git add -u`?BeginnerHow do you commit only part of the changes in a file?BeginnerHow do you change the last commit message or add a forgotten file?BeginnerWhat is the difference between `git switch`, `git restore` and `git checkout`?BeginnerWhat is the difference between lightweight and annotated tags?Beginner