One way to get a list of all Git repos under your current directory (project directory) is with the following command:
find . -name '.git' | xargs -n 1 dirname
To delete all branches in your Git repository except master, simply issue the following command:
git branch | grep -v "master" | xargs git branch -D