A Quick Way to Remove all Local git Branches Except for Master

I create a new branch for each new task, so I can end up with a plethora of branches. This is a quick way to remove all branches except master

By Rob Johnson

Mon Jun 26 2017

# git

Below is a quick way to remove all git branches on your local machine, except for master. This is really helpful for those of us who commit new branches for each new task.

git branch | grep -v "master" | xargs git branch -D

This snippet was written by Adan Alvarado.


# commerce 4 # seo 3 # productivity 1 # tutorial 14 # sql 3 # javascript 7 # projects 4 # git 2 # php 3 # analytics 3 # ux 1 # python 2 # aws 2 # mobile 1