If you've already committed a bunch of unwanted files, you can unstage them and tell git to mark them as deleted (without them being actually deleted) using this command
git rm --cached -r
--cached tells it to remove the paths from staging area and the index without removing the files themselves and -r operates on directories recursively till it has done his work of removing the paths from staging area for all files. You can then git add any files that you want git to keep track of.