I want to delete all branches that get listed in the output of ...
$ git branch
... but keeping current branch, in one step. Is th
For Windows, in Powershell use:
git branch | %{ $_.Trim() } | ?{ $_ -ne 'master' } | %{ git branch -D $_ }
Delete all branches except a specific branch:
git branch | grep -v "branch name" | xargs git branch -D
Delete all local branches except develop and master
git branch | grep -v "develop" | grep -v "master" | xargs git branch -D