Remove all local git branches and only keep the master branch

After some time, I have many local branches still exist. Just delete them all with this simple command :

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

This command is for delete your local git branches and keep only for master branch.

Leave a Reply

Your email address will not be published. Required fields are marked *