git clean untracked branches code example
Example: git remove untracked branches
# this is powershell script for Windows execution
git checkout master;
git remote update origin --prune;
git branch -vv | Select-String -Pattern ": gone]" | % { $_.toString().Trim().Split(" ")[0]} | % {git branch -d $_}