git-clean – Remove untracked files from the working tree. Follow below steps for removing untracked files

  1. Check what will be deleted by using the -n option
    git clean -n
  2. Enter below command to delete the files
    git clean -f

 

Also to remove

  • Directories, run git clean -f -d or git clean -fd
  • Ignored files, run git clean -f -X or git clean -fX
  • Ignored and non-ignored files, run git clean -f -x or git clean -fx

 

Reference

Git clean