Remove untracted files by git

Sometimes, when switch to another branch on git, and will find some file was untracted, I usually delete the files one by one. It’s very…

Sometimes, when switch to another branch on git, and will find some file was untracted, I usually delete the files one by one. It’s very time wasting, so I want to find a command to delete them together.

And I find that git clean command can do the work, the following command will delete all the untracted files:git clean -d -f

References

git-clean — Remove untracked files from the working tree
How to remove local (untracked) files from the current Git working tree