git-clean - Remove untracked files from the working tree -d for removing directories -f remove forcefully -n Don’t actually remove anything, just show what would be done. -X Remove only files ignored by Git. This may be useful to rebuild everything from scratch, but keep manually created files.
If the ignored files are already added to the index/staging, you must remove the files from the tracking index before using the above clean command.
git rm -rf --cached .
Then add the files except the ones included in the .gitignore file