git delete all local branch except master code example
Example 1: git remove all branches except master windows
git branch | %{ $_.Trim() } | ?{ $_ -ne 'master' } | %{ git branch -D $_ }
Example 2: git delete all local branches
git for-each-ref --format '%(refname:short)' refs/heads | grep -v master | xargs git branch -D