I want to delete all branches that get listed in the output of ...
$ git branch
... but keeping current branch, in one step. Is that possible? If so, how?
$ git branch | grep -v "master" | xargs git branch -D
will delete all branches except master (replace master with branch you want to keep, but then it will delete master)
2.1m questions
2.1m answers
60 comments
57.0k users